My anecdote…I used my last phone until it died. It was around 4 years old and the eMMC storage failed from age, making the device a suddenly totally unusable brick. Before then, it had gotten very slow and laggy over time and the battery life degraded to be pretty sucky…barely surviving the workday on standby in my pocket.
From my experience, I don’t know that I would necessarily advise using a device for that long. The battery just gets too shitty and its sudden death made it a bit of a scramble to buy a new phone. Granted, my previous phone was fairly low end, but even with a high end device, batteries degrade to almost unusable levels after a few years. I know it sucks for the environment, but it seems like less of a headache to keep a phone for only like 2-3ish years and then upgrade it while it’s still working as opposed to waiting for it to irreparably bork itself.
Edit: If you’re able to do a battery replacement, I will say that it does change the conversation somewhat. But long gone are the days of easily user serviceable battery replacements for most phones. Yes, there are obscure phones out there that make it easier to swap out the battery, but these phones aren’t exactly prominent.