But when I try to change my password apple says my apple id is not valid
Looks like that you tried to change the Password form another Apple ID.
You are sign in here . . . with your Apple ID (?)
Your Apple ID is the personal account you use with all Apple products and services. It includes the email address and password you use to sign in, as well as the contact, payment, and security details that you use with Apple.
You can’t merge multiple Apple ID accounts.
See this Apple article: If your Apple ID is locked or disabled
If your Apple ID is locked or disabled - Apple Support (CA)
-> Get a verification code and sign in with two-factor authentication
Get a verification code and sign in with two-factor authentication - Apple Support
Have you forgotten your Apple ID?, Check your Apple ID via your email box, see this Apple article: If you forgot your Apple ID
If you forgot your Apple ID email address or phone number - Apple Support
OR see -> Having trouble signing in?
https://iforgot.apple.com/password/verify/appleid
If you've forgotten your Apple ID email address or phone number
If you've forgotten your Apple ID email address or phone number – Apple Support (UK)