Can apple transfer my messages, contacts, etc, from broken iPhone 5 to new iPhone 5?

My iphone's lock button doesn't work anymore so i'm going to have them replace it but i don't want to lose my messages. Can they transfer them to my new phone along with contacts, pictures, apps, etc?

Added (1). The phone itself is fine and everything works except the lock button

What is your broken phones condition? If the damage is only on display then connect your broken phone in a pc or laptop then transfer all data to the Pc and reload it on new phone.

You can transfer most of everything by syncing your iPhone with iCloud (you can do that in Settings) and anything you find in there can be backed up. However, you can't copy over your messages and I don't know why you'd need all of them. Just copy and paste the important ones into an email or something.

Yes. Just back up the old 5 & restore to the new 5 in iTunes.