Security is only as good as the weakest link. Each company that touches the phone or the software increases the attack surface.
Therefore, from a security perspective, the phones with the best security are the iPhones and the Google Pixel phones. They also generally have the quickest security updates.
If you install a custom ROM (e.g. LineageOS), you can make almost any phone reasonably secure, but that involves a lot of time and hassle. If you don't trust Apple/Google, that's probably your best option.
An alternative approach is to have a second device for security sensitive purposes, which can be locked-down, only essential apps installed, offline by default, etc.