The lifespan of the iPhone has dramatically increased with each iteration, some more than others. Basically since the iPhone 7, with the removal of the headphone jack and the introduction of dust and water resistance, the iPhone extended its life the most and has only been increasing from there, with tougher glass, harder construction, and better batteries all helping to increase that. The average time to keep an iPhone from 2007–2013 was two years, meaning many people related their iPhones every year. The average time to replace an iPhone now is 3.5 years with many of those people who replace in less time reselling their iPhones. iPhones get 5–6 years of software updates (compared to what, 0.5–1 year for Android?) and many have a life beyond that. I personally know people who still use their old original iPhone 5 or iPhone SE.
The iPhone has become more resilient as technology improved. There will be diminishing returns though. The iPhone is pretty physically resilient at this point. So most of the longevity concerns will be lacking of new features and software rather than wearing out. The battery is always a big one but Apple is pretty good at offering low cost battery replacements. If you want to keep your iPhone for 4 years, one battery replacement over that time will make that possible.
Will the lifespan of iPhones continue to decline with each iteration, or will they become more resilient as technology improves?