We all go through tough times, but not everyone responds to stressors in the same way. Some are more resilient, while others adopt certain coping mechanisms-some of which may already be toxic-to deal with the stress. Trying times should not be used as an excuse for treating others terribly, but before you say "Thank u, next" to that toxic friend, maybe it's worth looking at the signs to see whether their actions are but a coping mechanism they can still work on and are not intrinsically toxic in nature.
You've never seen this unhealthy side of your friend before.
Toxic people do not become toxic overnight. Chances are, toxic friends have made tiny questionable acts towards you since the beginning of your friendship, and you just never really made a big deal out of them until things got worse over time.
But, if you've never seen your friend act so horrendously towards you and all of a sudden started doing so, it might be a good idea to tell them that you're not comfortable with the way they treat their friends. Hopefully, they would take it as a wake-up call from a concerned friend rather than a form of unwarranted criticism.
They admit to their mistakes, and apologize accordingly when given the chance.
Toxic people can't bring themselves to admit that they are treating others poorly, and often blame others for their faults. But if your friend offers a sincere apology for how horribly they've treated you, and you feel that they actually mean it, there might be a chance to save the unhealthy friendship and help your friend get out of that rut.
You can see that they are trying to improve on their behavior.
Some people just need more encouragement from others. A little nudge from supportive BFFs may help that friend who is behaving harshly realize that they are falling into an unhealthy coping habit and change for the better.
Unfortunately, for others, coping with stress leads them to take it out on the people around them. Stress isn't an excuse to treat others poorly, but rather than tell them off for their poor actions, it might be more helpful to let them know that what they're doing is unhealthy—not just for them, but also for the people who care about them—and offer a shoulder to lean on as they go through their darkest times.