Modern iphones may be supported for at least 6 years, for older devices there may be hardware limitations. For instance support for iphone 5/5c ended after 4 years in 2017. https://www.bbc.co.uk/news/technology ios is a closed system whilst many manufactures have Android devices with the software developed by Google which they customise https://www.androidauthority.com/android-skins Basically the Android system requires more work, so not really comparing like for like https://www.geeksforgeeks.org/difference-between-ios-and-android/ In any case certainly many customers will upgrade their device before 5 years.
I would argue that Android devices offer much greater flexibility,you have a lot of choices but in terms of quality and innovation premium Samsung Galaxy Devices have a lot to offer.
@Cilde if you do think about rooting ensure you do research beforehand and are aware of implications.
Personally I would not takes risks with security.