To change the gender marker on your passport, you will need to fill in the usual change of details form that everyone applying for a UK passport uses, which you can find here.
You will also need to provide a Gender Recognition Certificate, a new birth or adoption certificate with your new gender, or a letter from a doctor confirming that your change of gender will be permanent. You only need to provide one of these; most trans people will provide a letter from a doctor.
If you’re sending a letter from your doctor, all it needs to say is “[Name] is transgender and has changed their gender to [male/female]. This change is permanent.” Your usual GP is able to sign or stamp this letter, though they may charge a small fee.
If you’re sending a letter from your doctor, you’ll also need to send your deed poll, and some evidence that you’re actually using that name such as a payslip, bank statement or letter from the council.
Once you’ve changed your gender on your passport, you can just renew it when it expires without sending in anything extra.
Currently, the only available options in a UK passport are male (M) or female (F). Some countries also have an X gender marker, but the UK has not adopted this yet.