That's utter nonsense. A good Open Source system is the most secure system, as others can review the code for vulnerabilities. Android is less secure than iOS because of lack of updates by manufacturers and/or carriers, a whole of different forked versions of it, and various closed source cruft and crud put on top of it, and because it is far more customizable and extensible than iOS, but NOT because part of it is open source.
I'm a bit of an Android fan, I've had one iPhone that lasted 4+ years, and 5 Android phones that I've used collectively about that long. However, I would have to say that Samsung phones have so many weird bugs, and their longevity isn't hat great compared to iPhones. An iPhone is probably a better overall investment if you have the dough, as it will last longer.
I have a Galaxy S7 right now, which has had battery life issues, battery longevity issues, and a bunch of weird bugs, like Google Messages getting so slow it was unusable, so I went with Textra. I don't know what my next phone will be. I like the experience of the iPhone, but if they don't release a Qualcomm version of the iPhone XI with 4x4 MIMO and B14, then it's an absolute no-go for me. I've not giving up network performance for iOS. I also want to see what direction Apple is going, as I'm afraid a few years down the line I'd have to switch back if Apple stops using Qualcomm modems entirely, or be stuck for 5+ years on the last of the Qualcomm iPhones until it stops getting software updates, or until I have to have a phone with 5G NR in it.