A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation
For personal Microsoft accounts, Microsoft now says you can no longer add a phone number as a new security method. This method is being phased out. See official document here.
============
You need to have at least two security methods set up in the Security > Manage how I sign in option. If removing one will leave your account with one security contact method, then it will not let you remove. So, before you remove the old phone number, add another method, email a code, authentication app, or passkey. Once added, you should be able to remove the old phone number.