A few things can help. Crohn's & Colitis UK members get a Can't Wait card to show staff when you urgently need a toilet, and a RADAR key that opens thousands of locked accessible toilets around the UK. Disability Rights UK runs the Radar key scheme and sells genuine keys. The Bladder & Bowel Community offers a free digital Just Can't Wait card. The Toilet Map helps you find public toilets near you. None of the cards guarantees access, but they make asking easier.
Lists what members get, including the Can't Wait card (part of the membership card, to help you get urgent toilet access without having to explain) and a RADAR key for locked accessible toilets around the UK, plus the members' magazine and events.
Disability Rights UK runs the National Key Scheme, whose Radar key opens locked accessible toilets across the UK. This page explains the scheme's history, how the key can help, where it can be used, and how to buy a genuine key that is guaranteed by the lock maker.
How to get the Just Can't Wait toilet card, either as a free digital card for Apple or Google Wallet or as a plastic card bought online. Showing it explains discreetly that you need a toilet urgently and can help you use toilets not normally open to the public, though access is not guaranteed.