Tldr: I cope by going to free therapy sessions
First I would muster up all my energy try to activate my basic survival instinct, sit down and start planning.
How much money do I have? What is the runway, if I don't get more money, what is the last day I am able to afford to pay rent? Do I have any financial obligations that I can't get our of? I.e. where I once lived there were significant cancelation fees. Then I would make plan to extend my runway as far as feasible, with the limited energy I have.
If I feel that I am currently not capable of this level of planning (or that seeing the date I am probably becoming homeless would incapacitate me) I would go back to all of my friends that 'just tell me to keep trying' and asked for help.
"I am beyond keep-trying, I am not sure how long am I able to pay rent, and I need start planning contingency, can you sit down with me and help me with that?"
There might be some that in case your funds run out would at least let you crash on their couch.
I am not sure how you work, but for me, knowing my runway and gazing into the metaphorical abyss helps me muster my fight of flight reflex.
Second, I would look for a therapist. I am currently going for a one-on-one session for free, because the therapist is training on a new method and needs several reviews of patients before getting an attestation and being able to charge for it. If I already didn't have contact I would ask at local med-school?
Third. I would once again go back to my friends and ask them for jobs. A.f.a.i.k. going though the regular channel to get hired has high rejection rate, and if every rejection keeps you getting deeper into depression, then going through the front door is not hte route for me. If a friend can arrange a coffee with their manager, when they know they are looking for someone like you, with racks open, sending the resume could, in the best-case scenario become just a formality. (That is how I got my last job, more or less)
Last, if friends can't help you, I would start looking at less desirable/well payed jobs. I know that most of my peers wouldn't work for goverment, because pay is bad, but they are usually eager to hire anybody with the skills.