OP, I am so sorry it has taken such a physical toll on you.
The first thing to do is to take good supplements. I recommend herbal iron supplements like Floradix or feroglobin capsules, Vitamin D spray (e.g. D-Lux) and a B vitamin complex or Berrocca fizzy tablets.
If you can't eat much, make what you can eat count a lot. And give yourself small targets. Eat a small handful of almonds or walnuts for your children because they need you to be healthy and strong for them. Have a latte at work - full fat milk if possible, because you need to function, to earn a good living to minimise the impact of the divorce. Try having a smoothie in the morning, or a full fat fruit yoghurt at lunch time. You don't have to want to eat but do it for your DC's sake if you can't for yourself right now.
If you can afford it, buy yourself some small treats of foods you love and eat those because you choose to care for yourself.
Instead of trying to eat meals, have tiny snacks but graze on them often during the day and try to avoid living on biscuits or sugar. Nuts, cheese if you like it, fresh fruit, mini snack pots of rice salads or edamame beans.
Try to eat a bit with your DC in the morning and evening. Choose foods you find easy to swallow and digest. And for now, veyr high calorie versions of them, so a few bites are worth more. Two bites of toast and peanut butter or two spoonfuls of muesli will keep you going longer than toast and marmite or rice krispies.
For the sleeping, you could try going to bed with headphones set to a long relaxation meditation. It's not as good as sleep but it's second best to it. Jason Stephenson on You Tube is good and imo has a very soothing voice. But there are loads of options on You Tube. Don't worry about actually falling asleep, just relaxing the body and resting the mind will help so much.
Do a LOT of self care. Put on uplifting or soothing morning music, watch comedies that make you laugh in the evening. Spend 5 minutes every day either painting your nails or doing a quick facial or hair treatment. These can be from Poundland if you are broke from the divorce.
Keep a journal. Write down all the shit you can't stand having to deal with every day and then write down a few hopes for the future - imagine feeling healthy, having a pay rise, taking DC out for a dinner or even just an ice cream that you all enjoy. Plan some milestones that stick two fingers up at your ex, because they show you are thriving.
You will get through this.