If the account was set up with 2FA and they only remember the Apple ID and password is forgotten recover the account see the article How to use account recovery when you can’t reset your Apple ID password - Apple Support
If the account was set up with secondary authentication , and have forgotten all account credentials like three answers for security questions , date of birth , rescue mail address and its password and the Apple ID is not signed in the device contact apple support with credit card details in case added Contact Apple for support and service - Apple Support
The Apple ID say example1@icloud.com exists on server and you know the password and its account credentials , however that is signed in the device iPhone .
If you don't remember the trusted number and yet it is verified in the account , visit your cellular service centre with personal identification proofs , the number can be obtained from them .
If the account is set with two factor authentication from iPhone .
Issue a sim on behalf of the same number and insert the sim Set up cellular service on iPhone - Apple Support
In a new iPhone that is purchased Turn on and set up iPhone - Apple Support
The Apple ID and password is active so is the 2FA active on the iCloud server , once a new trusted number is added the code will start appearing on the new trusted number , and the person can access the account .
See the article Get a verification code and sign in with two-factor authentication - Apple Support
Then access the account and remove an old inactive verified number from the account .
Go to your Apple ID account page and enter your Apple ID and password.
In the Security section, click Edit.
Click Add a Trusted Phone Number.
To add a number, enter the phone number and verify it with a text.
To remove a number, click cross sign next to the phone number you want to remove.
Note : you don't need account recovery from the server as Apple ID and password are known to you How to use account recovery when you can’t reset your Apple ID password - Apple Support
If the account was set up with secondary authentication in which three answers for respective questions , rescue mail address and its password , date of birth is added , simply sign in with account credentials on new iPhone Sign in with your Apple ID - Apple Support
Note : the methods will be applicable in a scenario for what account ( 2FA or secondary authentication ) and which account credentials do you have in records .