I asked about this when I renewed my passport.
The online form asks for gender, not sex. So I called the passport office and asked if a could leave it blank as I don’t have a gender. They said no, you have to complete the whole form, but in any case, it doesn’t matter because they convert what you put as your gender to sex on the actual passport. So someone who ticks female for the gender question gets sent a passport with F as the sex.
When I said but this is a document that is used to identify you their answer was that it still is. It’s not a document to verify what sex you are, just that you are the person on the passport.