(I hope it's not seen as outrageous to suggest this, but) perhaps one shouldn't tolerate this sort of behavior anywhere, ever?
Everyone deserves safe and clean public spaces.
Everywhere should be safe.
It obviously makes sense to start with the space that gives you the most return for the lowest cost and that would be any public space that has the highest usage and density, such as public transit stations.
Even better, imposing safety in those transit stations will also have a significant effect in improving safety through the length of the actual BART train ride because access to the train is limited to the few stations.
This is not true of a random sidewalk.
There is a cost to this and that cost includes the coercive use of force to prevent that behavior.
IIUC, it's only that simple at a very superficial level. I.e., the complexity arises when you have to answer what you do about the offenders.
TL;DR:
(I'm not actually from SF, so apologies if I've misunderstood residents' views on this.)
Do you punish them? I get the impression most San Franciscans see drug addicts as pitiable victims of bad choices or the opioid epidemic. So behavior modification via punishment would be evil.
Do you put imprison the drug users for the safety of others? That sounds like punishment, which again most SF'ers reject.
Do you put the drug users in mental institutions / forced rehab? I suspect this reminds people of the dark days of abusive mental institutions, and is therefore rejected.
And what about people who are clean and sober, aren't homeless by choice, but for whom public housing isn't available? I.e., they're not mugging anyone, but they can't find anywhere else to sleep, poop, or pee? You have the sticky question of whether or not residents are legally obligated to have a home.