If you replace your iPhone or iPad, it's easy to get it back up and running on the new device by using your iCloud backup and we'll show you how to do that here.
Your iOS device should already be backing up to iCloud, but it's worth checking that you have a very recent backup before you start. To do this, tap on the Settings app.

Now tap on your name at the top of the settings screen and then tap on iCloud.

Now scroll down through the iCloud settings and tap on iCloud Backup.

You'll now be able to see when the last backup ran, if it's not completely up to date, tap on Back Up Now to run another backup. This should only take a moment.

Now, on your new device, follow the prompts to start the set up procedure.
If your old device is running iOS 11 or newer, you can simply bring it near your new device and the transfer will start automatically.
If your old device is running an older version of iOS, you can tap on Set Up Manually and then connect your new device to your WiFi network.
Once it's connected, tap on Restore from iCloud Backup. You then choose the backup you would like to restore from and the process will begin.
Once the restore is complete, your new device should look just like your old one. All your apps will then start to install and all your email accounts etc should be set up and working.