If you want to use a phone for 5-6 years while retaining a decent level of security, buy an iPhone XR. You don't have other options. Please stop using insecure old Android phones and don't bother pretending that ROMs unable to ship full security updates change that situation...
Conversation
Replying to
As I said, it doesn't change the situation. They don't provide most of the driver and firmware security updates after the end-of-life, and in many cases the updates aren't even shipped in ROMs during the lifespan. Not to mention that they roll back security from baseline AOSP.

