This is a behavior often misunderstood by those who want to be a good person and are trying to be helpful and compassionate.
It's obviously a good thing to want to be kind and considerate. And to be understanding of people who are in distress, including, sometimes, those who behave badly. You want to be tolerant of their predicament.
This becomes a problem for you when you become an enabler and allow someone to take advantage or otherwise be harmful. Adults are responsible for their own behavior unless they aren't capable of doing so. If they fail to work on their issues, that's their responsibility not yours.
It can be difficult and painful to watch them struggle. You may feel their pain intensely. But some people will never resolve their issues, despite your efforts.
Remember that your wellbeing has value beyond being an enabler or a martyr. It's in your best interest to set and maintain boundaries. And there may be unpleasant consequences.
Only you can decide how you want to interact with them. Depending on the situation, you will eventually have to ask yourself how much longer you're willing to place your own health in jeopardy.