Awareness
Notice your surroundings: exits, who is nearby, what feels out of place. Put the phone away in parking lots and at transit stops, and trust the feeling that something is wrong.
Avoidance
The best outcome is not being there. Change direction, cross the street, go into a busy shop, or leave early. Plan routes and travel with others when you can.
De-escalation
Keep distance, keep your hands visible, speak calmly and give the other person a way out. Property can be replaced. Walking away is a win.
Know the law
Self-defense law is specific and varies by state. A good course explains when force is and is not lawful. For advice about your situation, talk to a qualified attorney.
Where firearm training fits
If you choose to own a firearm for home defense, safety and regular practice with a qualified instructor matter more than the equipment. Start with a beginner safety class.