I have had recent iPhones, Pixels, and a Samsung phone, all high end. I'm a bit biased, but I do honestly think that Pixels are better or the same build quality compared to Samsung. The software is better for me too, but I accept that's a lot of personal preference.
I think the iPhones are out in front a little, but in a way that I'm not sure really matters. I loved the iPhone hardware I've owned, but the difference in build quality isn't noticeable unless you look carefully and isn't noticeable in a case. The only way I'd say it's noticeable is if you're a hardware nerd who knows how the things are manufactured, or if you get a repair bill. What Apple have done with iPhone hardware is a huge achievement, but said as someone who likes owning nice things, I'd happily take a Pixel 10.