2 years for major software updates(1 major update 9.0 (pie) is being received and 1 more android Q will be coming next for phones released with Oreo ) and 3 year's of security updates. This is Samsung policy of updates. And also most OEMs policy other than Google. Major update are recieved yearly and security updates are recieved monthly.
yes, but Apple major updates and security updates are received for iPhone is 5 year's. iPhone 5s released in 2013 20 September. For ipads it's 6 year's. for ipod touch 6+ counting. Android update os release has more stages than iOS which ultimately delays and limits it's updates. I simplified the answer ,there is more depth to the topic.