For the iPhone, you can always buy two generations back to save a few bucks. I bought an iPhone 11 a couple months ago for $499 plus tax and it’s a perfectly good phone.
One thing you'll lose with the older phones sooner than iOS updates is AppleCare support, but if you get a good bargain to begin with....
https://9to5mac.com/2021/09/23/apple-releases-ios-12-5-5-for...