How can I check if an iPhone is new or refurbished based on its serial number?
I don't think you can do it with the serial number, but if you were given a replacement in a box that looked like the original packaging, then it's new. Else it is a refurb — at least, that has been my experience with Apple so far. This thread also supports that:


  If the replacement was from a black box (with the iPhone pictured on it), that's a new one. If you need to have your phone replaced in the first 14 days, it should be done as a retail swap. After that, for warranty replacements, you'll be given a refurb (assuming they are available, they take a while to get into the pipeline). Generally, replacement iPhones are packaged in plain white boxes with no accessories. New ones can be packaged like that too, for Genius Bar replacements, but after the phone has been out a while they will mostly be refurb units.


So in short, if you're looking at replacing an iPhone just a few weeks or a couple of months after release, then it's most probably a new stock. If it's been a while since the model released, then it's most probably a refurbished phone.