iphone 5, but barely. Galaxy s3 was out much much before, and was pretty much the same as an iphone 5. If they released a new version right now it would surpass the iphone 5, apple would copy them and make an iphone 6 with the same features as the new galaxy, and saying it was their idea.
Better? There really isn't a better phone because that's just an opinion. The Galaxy does much more things, has a faster processor, a bigger screen, more durable materials etc etc. But I doubt it'll ever be as "cool" or as "popular" as the iPhone.