Install a rom that continues to receive updates
Disclaimer: I’m a 15 year iPhone owner, so I don’t have practical experience with this, but this is the angle I’d be researching, were in your situation. Or considering an iPhone, lol, Apple is still updating 10 year old phones. Of course, I don’t expect this crowd to take that last comment seriously ;)
I haven’t used the same iPhone for 15 years… I upgrade every 4 years or so.