To change passcode, go to settings > Touch ID and passcode > Tap on "change passcode".
If you're locked out of your phone, you will need to restore the phone with iTunes in DFU mode. You will need your Apple ID to set up afterwards. If you don't have a back up, you will lose your data, including photos.