See the steps in this article for information on getting a verification code (this might fix your issue): Get a verification code and sign in with two-factor authentication - Apple Support
If that doesn't work, you're looking at account recovery, which is a much longer process described here: Recover your Apple ID with two-factor authentication account recovery - Apple Support