The UK does not have specific legislation on who can use which toilet. No government or authority in the UK has ever suggested bringing in a “bathroom bill” along the lines of those which have been introduced in some parts of the USA. It is therefore not illegal for a trans person to use the toilet which aligns with their gender identity, and a trans person cannot be arrested or prosecuted simply for doing so. This is regardless of their legal gender, or what medical treatment they have or have not had.
The UK government’s advice on trans people and toilets has not always been especially clear. Technically, the Equality Act 2010 does allow for businesses and organisations to insist upon single-sex spaces (including excluding trans people from their space of preference) if doing so would be a “proportionate means of achieving a legitimate aim”. However, it is generally considered unlikely that a business could use this to justify excluding trans people from toilets where everyone uses an individual cubicle, as it is hard to see that doing so would ever be a proportionate way of achieving a legitimate aim (since considerations such as privacy could be achieved simply by closing the cubicle door). A lawyer giving advice to the Parliamentary Inquiry into trans rights also concluded that it is unlikely that this provision could ever be justifiably used to exclude a trans person with a Gender Recognition Certificate from any single-sex service or space.
One court case in this regard has taken place, and found that a pub which told a trans woman she could not use the ladies had unlawfully discriminated against her, and awarded her damages.
Many organisations also provide gender neutral toilets. These are toilets which can be used by anyone, of any gender. Gender neutral toilets are not a new thing – many cafes and shops only have one toilet, which is therefore available for use by any customer. I was at the University of Durham in 2003, and the bathrooms in my residential building were all gender neutral (I don’t think that was a trans thing: the bathrooms had been designed that way many years before).
Gender-neutral facilities can be particularly helpful for non-binary people, and for trans people who do not feel confident or safe in gendered facilities. They can also be useful for other groups, e.g. parents who need to accompany a small child of a different gender to the toilet. Where a building has single-room toilets, it is often more practical to make them all available for everyone anyway: why have six women queuing up outside one toilet when there is another next door which isn’t being used?
Where a building has male, female and gender-neutral toilets, trans people should still be able to use whichever facility they feel most comfortable with.