This article explains how to smoothly switch from one iPhone to another, transferring all your data.
Steps
Method 1 of 2: Using iCloud

Step 1. Open the Settings of the old iPhone
Look for the app with the gray icon with gears (⚙️), which is usually found on the home screen.

Step 2. Press your Apple ID
This is the section at the top of the menu that contains your name and an image if you have added one.
- If you are not logged in, press Log in to your iPhone, enter your Apple ID and password, then press Log in.
- If the iOS version is not the latest, you may not need to complete this step.

Step 3. Press iCloud
You will find this item in the second section of the menu.

Step 4. Select the data to copy
Check the apps listed in the "APPS USING ICLOUD" section, such as Photos, Contacts and Calendars. Move the buttons for the information to be transferred to the new phone to "On" (green).
Any data set to "Off" (white) will not be copied and transferred to the new iPhone

Step 5. Scroll down and hit iCloud Backup
It is located in the lower part of the "APPS THAT USE ICLOUD" section.
Move the button ICloud Backup to "On" (green), if you haven't already.

Step 6. Press Back up now
You will see it at the bottom of the screen. Press it to manually start backing up your old iPhone. Wait until the operation is complete.

Step 7. Press iCloud
This button is located in the upper left corner of the screen. Press it and you will return to the iCloud settings page.

Step 8. Turn on the new iPhone and complete the initial setup
You will be asked to specify some information, such as language, country, Wi-Fi network and more.

Step 9. Press Restore iCloud Backup
Do this when you are asked to choose a method for setting up your new iPhone during the setup process. Instead of setting the new device as a data-free iPhone, this will transfer the information from the old cell phone to the one you just bought.

Step 10. Press Next
You will find this button in the upper right corner of the screen.

Step 11. Enter your Apple ID and password
Do it in their respective fields.

Step 12. Press an iCloud backup
Choose the one with the most recent date and time.

Step 13. Press Reset
The data from the old iPhone will be copied to the new one.
Wait for the new iPhone to restart after the data is restored. When done, you can start using it
Method 2 of 2: Using iTunes

Step 1. Connect the old iPhone to a computer
Use the USB cable supplied with the device.

Step 2. Open iTunes
Do this if it doesn't open automatically after you plug in your device.

Step 3. Click on your iPhone
When iTunes recognizes your phone, you will see the phone icon appear at the top of the screen.

Step 4. Click the "This Computer" button
It is located in the "Back up automatically" section.
If you want to back up your passwords, Homekit, Health or Activity data, you need to check the "Encrypt iPhone backup" box and create a password that is easy to remember

Step 5. Click Back Up Now
It is located in the right pane of the window under the "Manual Backup and Restore" section.
Wait for the backup operation to finish and for iTunes to save your data. The process can take a few minutes, depending on the amount of data on your phone

Step 6. Click the Eject button, then disconnect the phone from the computer
You will find it to the right of your iPhone name. Unplug the USB cable from your computer.

Step 7. Turn off the old iPhone
Do this by pressing and holding the lock button at the top right until "Swipe to power off" appears on the screen, then slide the button to the right.
If your iPhone has a SIM, remove the card from the old phone and insert it into the new one

Step 8. Turn on the new iPhone
Do this by pressing the lock button.

Step 9. Complete the initial iPhone setup process
You will be asked to choose your country, language, geolocation service preferences and more.

Step 10. Press Restore iTunes Backup
You will see this item among those available for configuring the new device.

Step 11. Connect the new iPhone to the computer you used previously
Use the cable that came with your newly purchased device, as it may be different (lightning connector instead of 30-pin).
iTunes will recognize the new device and you will see "Welcome to your new iPhone" on the screen

Step 12. Click on "Restore from this backup"
Select the most recent backup from the drop-down menu.

Step 13. Click Continue
iTunes will start transferring data from the program to the new iPhone.