My phones 'die' when the security updates stop or the battery dies (assuming non-replaceable). I don't use iPhones because I can't deal with who Apple treats its users. Thus, I use Android One phones. That guarantees phones get security updates for 3 years. Then there is the issue does that battery hold up and is it worth replacing it. Also, depends on how much RAM is on the Android device has. That is one of the main issues I see with Android nowadays. App RAM usage bloat is going nuts.
After the phone runs out of security updates, I still use it, just not as a daily driver. I use old phones for hobby projects, or change the ROM on them to keep them up to date. The problem with many ROMs is that they often have defects like the NFC, the fingerprint reader, the camera, which doesn't work reliably. I can't deal with that in a daily driver.