In most of the US, my experience has been that every gas station and every restaurant has a public restroom that's unlocked at all times. They're sometimes nasty, but always available, and even the ones that are nominally for customers only aren't regulated at all.
There are some places I've been that keep the restroom locked, but where I've been that's a sign that you're in a particularly sketchy neighborhood, not a regular thing. The first time I had a major problem finding a restroom at all was driving through Las Vegas a few years ago. I've only become aware that there are other places like that through articles like this on HN.