Generally, I feel like the Mercury News homicide map is a good representation of the roughness of the area, and it doesn't look like SF is as different from those areas as you propose. From the looks of it, it's one step up from dead last, Oakland.
This map is proving my point. Even if SF is one step up from dead last, if we look at a complete year (2021) there's a HUGE difference between SF and Oakland. By comparison SF looks relatively safe, and having lived in both cities I can attest to that.
The rough parts of SF are a cakewalk compared to Oakland's. Not only that, but at least in SF the roughest parts tend to be pretty concentrated to a small area.
I didn't want to point out Oakland by name because I still think it's a pretty awesome city and visit it often. Seeing SF being singled out by the (social)media as a hellscape makes it pretty clear they're really unfamiliar with much of the SFBAY.
The truth is that most culturally significant cities have both good and bad parts to them.
Ya it pales in comparison to Oakland (low bar). But it's still #37 of 100 in violent crime, and is #4 highest property crime.[0]
And with Oakland, it's all happening in the West and East Oakland hoods, separate from the places most people here and visitors would frequent. But with SF, it's all over the main areas of the city (obviously still somewhat concentrated in a radius around Tenderloin) where people are going about their day to work and tourists are passing by.
Outside of theft [1], SF ranks in the lower half per capita in most categories in this chart, including burglary. Of course it would be better if it was even lower, but what I see and experience, is a relatively safe city considering its population.
[1]Yes I care about theft, but my personal safety and those I care about rank much much higher than my property, and what I'd consider being "safe" in a city.
https://www.mercurynews.com/2022/01/04/bay-area-homicides-20...