Hi saer98,
welcome to the Apple (user-to-user) Community!
Re: "Verification codes can’t be sent to this phone number at this time. Please try again later".
Could that phone number be already in use with another Apple ID ?
Else:
If you haven't already: Wondering if updating your MacOS version to the newest version may help:
Eg: What's new in the updates for macOS Sonoma - Apple Support
says macOS Sonoma 14.6.1 is the latest version:
"This update includes important bug fixes and addresses an issue that prevents enabling or disabling Advanced Data Protection"
NB: It is always wise to back-up the data on your Mac before updating
_________________
Restarting your Mac (Apple Menu > Restart) is another option that often restores order when something is not working as expected ... (eg: deletes temporary files, re-establishes connections, may update recent setting changes, and more.)
________________________________________________________
Also: There are a few ways you can get a verification code. You can use the code displayed on your trusted device, get a text or phone call, or generate a code from your trusted device.
Get a verification code and sign in with two-factor authentication - Apple Support
All the best :-)