Boundaries are limits you set for yourself, and they protect you. When someone trespasses into your private space, you are alerted to danger and might be forced to do things you'd rather not. Or at the very least, feel very uncomfortable.
Not everyone is considerate, empathetic or able to perspective-take. People may not be aware their behaviour is harming you. Setting boundaries informs others what you consider to be acceptable or unacceptable behaviour.
For example, in times of COVID19, a friend without a mask speaks closely to you. You immediately ask the friend to wear a mask and maintain social distance. By doing so, you assert your boundaries to protect yourself and inform your friend their behaviours are unacceptable.
Protect yourself from potentially dangerous people and situations. Identify your boundaries by writing a list of unacceptable behaviours. This list will evolve as you encounter different situations and gain experience. Next, have the courage and practice asserting your boundaries.
You don't need to sacrifice your safety and sanity, even if to help others in need.
Stay safe. Protect yourself.