My solution to this was to sell my home and leave San Francisco after living there 19 years. The moment I had a baby on the way, it no longer became tenable for me to deal with the lack of cleanliness or safety on the streets.
The irony is that I moved to Mexico City. It’s a far safer place than San Francisco.