This is a good question, and part of developing your non-technical skills. I go to the loo a little more often. Might be just after I book on, or after 1st train of the day on arrival in London etc. Yuu have 1 or 2 official breaks in the shift but there are other gaps of 10-30mins here and there for turnarounds (use train loo), coupling/uncoupling (use station loo), etc.
In the rare case when you unexpectedly get caught short, had a dodgy mutton vindaloo last night etc, you stop the train, contact the signaller, explain the situation and use the train loo. You are blocking the line at this point, so they will need to know why and maybe route other trains around you if it's busy.