On an iPhone or iPad, open the Settings app and tap Face ID & Passcode or Touch ID & Passcode. Enter your current passcode, then select Change Passcode. Type your old passcode again before entering a new one. You can also tap Passcode Options to choose a custom alphanumeric code for better security. After confirming the new passcode, your device will start using it immediately. Regularly updating your password helps keep your personal information, apps, and accounts safer from unwanted access.
know more about how to change the password of phone (https://devicefixes.com/blog/how-to-change-the-password-of-phone/)