3 years for operating system updates from the time they first appear in the store. The iPhone 6s from 2015 ran the latest OS until September of this year. The iPhone 5s from 2013 just got a security update this past June.
On top of that, it depends on where you bought the device
> If you bought your device elsewhere, updates can take longer
Apple users get updates regardless of whether you bought the device from an Apple Store.
> Pixel 6 and later phones will get updates for at least 5 years from when the device first became available on the Google Store in the US.