1. Remove yourself physically from the space you were feeling the emotional pangs. Find a private place and allow yourself to feel it until you believe it's had enough audience. Now concentrate on breathing until you feel the depression/anxiety wane to a functional level. It's too easy to just keep dealing with it and carrying it, but we are finite containers. People may not understand this practice and be offended if you leave, so explain it before or later, but either way just make the time.
2. Improve your situation slightly, and by this I mean put your full attention into a small project that can be completed in one go. Cross off a chore, fix a meal in advance, pay a bill, walk the dog, something. The point is to accomplish some little victory that adds dopamine back into the brain soup and lifts a little of the subconscious burden.
3. Create something. Don't make it a big deal. It doesn't matter at all what medium is or what your skill level is or if it's worth showing to anyone. It's for you. Expressing what is difficult to articulate otherwise and honing the ability to do so are life skills that everyone has a right to.
4. Go to bed at a reasonable time, and try to relax again before lying down. Set an alarm early enough to give you some time to repeat steps 1-3. If you can't sleep, read, but probably fiction and probably not for very long. Your entire being needs true rest to survive.
5. Rise early and do steps 1-3. Have water before coffee. Eat a sustaining breakfast. Take stock of what you have before anxiety about lack creeps in. In this way you'll be bolstered to recognize the thought loops as far more fragile and distorted than they appear when you are weakened.
6. Do this as often as you can and take notes on what works best and what doesn't work. It won't prevent depression or anxiety from coming on, but it will help you to identify triggers and remedies.
7. Remember that everyone experiences this differently. The insight you gain from your own mental hygiene practice doesn't give you a master key to fix people. What it does give you is a way to keep yourself in tune so you can be of better service to them.