This article explains how to change the mobile number to send a security code to to verify your identity on iCloud if you forget your password or want to log in from a new device.
Steps

Step 1. Open the iPhone settings
The icon looks like a gray gear and is usually found on one of the main screens.
If you can't find it on the home screen, it may be in the "Utilities" folder

Step 2. Scroll down and tap iCloud
It is located at the top of the fourth section within the settings menu (under "Privacy").
If you aren't already signed in to iCloud, enter your Apple ID and password

Step 3. Tap your Apple ID
It is the first section at the top of the menu.

Step 4. Tap Password and Security
It is the second option on the menu.

Step 5. Tap Add a trusted phone number
It is located in the third section of the menu.
If this option does not appear, return to "Two-Factor Authentication" in the second section of the menu. Follow the on-screen commands to complete the procedure

Step 6. Enter the new phone number you want to use

Step 7. Select a verification method
Tap "Text Message" or "Phone Call" to choose how to receive the code in order to verify the new phone number.

Step 8. Tap Next
It is located at the top right of the dialog box.
- A dialog box will open on your mobile, prompting you to enter your six-digit verification code.
- The code will be sent to the telephone number indicated by message or phone call.

Step 9. Enter the verification code you received
The new number will appear in the list of trusted phone numbers.

Step 10. Tap the old phone number, which is the one you want to change

Step 11. Tap Remove Phone Number

Step 12. Tap Remove
This will change the phone number that will be used to verify your identity on iCloud. In the future, security alerts and verification codes will be sent to the new number entered.