on MacOS they provide security fixes for two years for unsupported OSes (after that the only remaining security protection is Gatekeeper/Notarization). On iOS you generally get no security fixes unless the vulnerability is really bad
AFAIK Apple has no published policy. Their last several macOS releases have received 3 years of security fixes.
iOS now seems to get 5 years of security updates, but only for devices that can't upgrade to newer iOS versions - so iOS versions that don't strand any devices get cut off early. e.g. iOS 15 received 3 updates in 2026, but iOS 17 hasn't been updated since 2025.