You might find this article from apple useful:
Obtaining service for your Apple product after an expired warranty - Apple Support
Based on that article there is a hard cutoff at 7 years since sales were discontinued.
And a soft limit at 5 years where service might become a bit harder.
If you are talking about software updates it does not quite follow this setup
But it is around 5-6 years based on precedence
the iPhone 6s probably had its last major software update with iOS 14(2020). which was 5 years after it was released(2015).
Once iOS 15(2021) releases iPhone 6s had had the newest version available for about 6 years.
The iPhone 6 on the other hand was released in 2014 and had its last major update in 2018 a total of 5 years with the newest OS.