This applies most anywhere; ask the locals. Some parts safe, while others are simply bad. Doesn't matter if it's San Diego or Detroit. I've been in Philadelphia, some nice areas where you go a few blocks and it becomes a ghetto. Same for D.C. About 20 years ago in San Francisco, local government put out maps for tourists showing directions to attractions at the beach. A straight path put tourists thru a ghetto where punks would throw rocks at cars, worse things happened to walkers. (The ghetto is since gone and things got better.) D.C. is scary, the last time I was there I learned the hard way not to stay at a cheap hotel (couldn't go out at night).
The disease that infects DC has spread beyond the DC Beltway. It has gone past once quiet areas like Waldorf and Bowie and even has gone as far south as La Plata MD.