Forgetting your Apple ID password can lock you out of iCloud, and Activation Lock can stop the phone being reset.
1. Settings, your name, Sign-In and Security: check your trusted phone numbers are current.
2. Account Recovery: add a Recovery Contact (a family member with an iPhone) who can help you get back in.
3. Write down your Apple ID email and password and keep them safe.
4. Forgot the password? Use iforgot.apple.com, or "Forgot password" on the iPhone.
5. Selling or giving away the iPhone? Sign out of Apple ID first (see our tips).
Only the real owner can remove Activation Lock, with the Apple ID or proof of purchase through Apple.