Lol yeah. The reality is that any metropolis will have dodgy areas. Tokyo is super-safe, but even there you don't really want to look funny at a yakuza bouncer in Ueno at 3am.
The question really is whether SF has more dodgy areas than average, and I guess the answer is yes. I've been a couple of times, and it was a long time ago, but some very central areas felt a bit too unsafe even during the day.
Part of the thing with SF is that it's somewhat unusual in that a business traveler attending an event at the Moscone is at more or less ground zero for some of the seedier parts of town: the Tenderloin, Civic Center, generally W/SW of the Moscone.
(This probably used to be somewhat true of the Javits in NYC but that whole area of the city has generally gentrified with the Hudson Yards project being the latest big change.)
The question really is whether SF has more dodgy areas than average, and I guess the answer is yes. I've been a couple of times, and it was a long time ago, but some very central areas felt a bit too unsafe even during the day.