Also worth noting that SF contains most of the Bay Area’s high-crime areas, yet the city limits are much smaller than those of most major American cities. So that skews the crime rate upwards. There’s a similar dynamic at play with several other American cities.
The line drawing was a policy decision, and it makes regional level policymaking near impossible, creating adverse incentives for suburban jurisdictions and constraining the options of local policymakers in SF. It’s the cause of many of the Bay Area’s current social woes.