I don't remember the details of it, but android uses more ram for applications, because of the dalvik VM. The iPhones also have way more cache on dye in the A CPUs. And apple completely decimates the competition in browser benchmarks.
I had a z3 compact before and was happily using it for 4 years before that(when I bought it was already old). Someone patched the system so that the camera apps still work on an unlocked device and I used a custom ROM which was working well.
Here's the thing about android devices. When you can keep them up to date with custom roms you gain things like fine grained privacy settings and faster lean custom ROMS.
But ... Sony is notoriously bad at that. Not only did their software quality degrade. They added more DRM and security features to make sure your Camera and other DRM functionality will not work on your custom ROM.
Compare that to Xiaomis Poco spinoff where they recently send all the XDA custom rom developers a free device to get the community involved.
I like Sonys devices but the software is utter crap. They completely botched the Android 10 update for most of their devices. It took them 2 months to release a version that wouldn't randomly fail and even then gesture navigation is not working in the older flagships. With Sony devices you can estimate only getting 2 major update the second one likely being buggy. Compare that to the iPhone update strategy which is a million times better.
To some extent the Android 10 disaster is to be blamed on Google since apparently the fingerprint problems existed in almost every vendors Android 10 release. I guess that when google moved their pixel 4 to no fingerprint/only faceID(or google face unlock) they just didn't care enough about other Android OEMs.