First, do not confuse a password with a passcode. They are not the same thing. iPhones have a passcode set on them, not passwords. Is it that for which it is asking? You need a passcode to get into a device. Passwords are for getting into accounts unless you have a device that is activation locked and requires you sign in with the user name and password.
Your post is also confusing in that initially you say you forgot the Apple ID, then you say you forgot the password.
This article tells you the various ways you can try to discover your forgotten Apple ID --> If you forgot your Apple Account primary email address or phone number - Apple Support Typically an Apple ID is an email address you have used. If you are currently using a mobile device that is logged into your account, go to Settings and tap your name at the top. Look in Keychain, and in a browser's security settings if you use it to automatically sign into Apple when using a browser.
This article outlines what to do If you forgot your Apple ID password --> If you forgot your Apple Account password - Apple Support
or go directly to this link --> http://iforgot.apple.com/
If you find you can’t sign in, reset your password, or receive verification codes, you can request account recovery (read this support article: How to use account recovery when you can’t reset your Apple Account password - Apple Support ) to regain access to your account. Account recovery might take a few days or longer, depending on the specific account information you can provide to verify your identity. More detail in —> Activation Lockout Issues - Apple Community
If you still need help this page provides country-specific Apple Support contact information ➞ Contact Apple for support and service - Apple Support