For anyone who's unaware, the current iOS 15 supports iPhones going back to 2015.
Their software quality for the latest and greatest updates leave much to be desired, but they take care of their existing devices better than anyone else on the market.
For a phone. Android has set the bar incredibly low. Kobo has supported their $130 Kobo Touch eReader from 2011 longer than any iOS device. On PCs its trivial to run modern software even on ancient hardware like a Pentium 4 with Linux/BSDs. Even Windows can let you easily get 15 years out of a device.