Gosh, that's a tough question. Initially, I would have thought it would be the iPhone... that's what attracted me. The iPhone is like a gorgeous cover of a book... and as we all know, you should never judge a book by its cover... it's what's inside that matters. So my answer would have to be iOS... because without iOS, what would the iPhone be?
The thing with the iPhone is that it's such a symbiotic relationship between software and the hardware. For example, we don't get FaceID without the hardware necessary to power it.
So I guess if I HAD to pick one. It would be the hardware. The hardware is what powers the software. Without great hardware, we don't get the features we enjoy on a daily. So my choice would have to be the hardware. Great hardware is what gave us FaceID, an amazing camera (in partnership with strong image processing via software) and a gorgeous display.
iOS for me, without question. I love how no matter what hardware an iOS user has, I can always get them right where they need to be due to the software being identical across the board.
IPhones, even those a few years old are more than capable. They are being held back by IOS.
Well you can't have one without the other, so I vote "both".