Apple offer a two year warranty for the new phone and then a limited warranty of 6 months for any replacement – To stop people abusing the system. This seems to be regardless of who your carrier is as they can trace ownership through your iTunes account.
I’ve had three phones replaced for brand new phones over the last couple of years. Each phone was diagnosed with a manufacturing fault: Pixel display, headphone jack and power management.
Not a great advert for the quality of the hardware but Apple’s service IS second to none. I’ve used the Genius booking system and I’ve also walked my phone into the Apple store and I’ve been bumped up the queue system. I had a flight to catch so they went above and beyond to help me.
On each occasion I was checked into a triage, then 10-15 minutes prepping the phone and paperwork with the Genius staffer and then walked out with the new phone. One takeaway is always backup to iCloud!