It won't happen.
But if it had to happen, I would hope apple did it easily by doing like a time period where you go on apple.com and put in your serial number and such information and keep your phone. Then you submit the information and select either in store pick up or delivery. For in store pick up you would need to exchange the phone for which information you put into the computer. Even exchange. For the delivery, you should have the phone delivered and use the same packaging box with a tracking slip supplied by apple and send the defective iPhone back to apple. If they didn't receive the phone back after a certain amount of time, you would just be charged for two phones.
It's really simple and easy, so apple probably would not go this route.