Did you retain your phone number or is there a new number in your new iPhone?
You can use a trusted number to receive a code to sign into iCloud. See Apple's document Get a verification code and sign in with two-factor authentication - Apple Support and scroll down to the section called Receive a text message or phone call
This requires that you have set this number up as a Trusted Number in your iCloud account which you can do at icloud.com if you can't do it on your iPhone.
Two-factor authentication for Apple ID - Apple Support
To see, add, or change your trusted phone numbers:
- On your iPhone or iPad: Go to Settings > [your name], then tap Sign-In & Security. Tap Two-Factor Authentication, then tap Edit. From here you can remove an existing trusted phone number or add a new one.
- On your Mac: Choose Apple menu > System Settings, then click your name. Click Sign-In & Security, then add or remove a trusted phone number.
- Go to the Account Security section of appleid.apple.com