If I buy a new iPhone how can I get everything transferred from my old iPhone?

Here’s how to transfer data from your old iPhone to a new one with iCloud.
First, connect your old iPhone to Wi-Fi.
Open the Settings app.
Tap [your name] > iCloud.
Select iCloud Backup.
Tap Back Up Now.
Wait until the backup process is completed.
Turn on your new phone and connect to Wi-Fi.
Log-in to your iCloud account and sync your backup. Voila.