Apple use Sony sensors while the samusung also use the sony sensors but apple ones are the best on the market right now, apart from that the post processing software of iOS is much better than any ANDRIOD phone to date (including Sony, Xperias, xeomi etc), thats the main thing, then the optics use on the lens.
The most important part is the image pocessing processors apple used are much much better then samsung. the latest note 9 launched even can’t compete with 1 year old iphone x just because of software processing and camera sensor. But There’s far more to camera quality than just the sensor. Other key factors include the lens quality, the camera software, and of course, the image Signal Processing.
The ISP is one component that people often overlook. Apple gets a lot of recognition for the CPUs and for the motion chips (M7/M8) it designs, but one of the most impressive things Apple does is use all its knowledge of semiconductors and photography to create amazing Image Signal Processors.