Overeating when exhausted

Hello. I am on a journey of weight loss and doing really well. I’m trying to lose the last 5 kgs or so.

However, I’ve noticed a clear pattern of overeating / eating off plan (can feel even like small binges) when exhausted.

I’m a 48-year-old woman. I believe my sleep has been affected by hormones even though I’m on HRT. I sometimes wake at 2 or 3 am and then can’t go back to sleep easily (or at all) which the next day leads often to afternoon off-plan snacking. Afternoon is the time I feel the exhaustion most. This is a clear pattern as I don’t eat off plan when not tired. But I seem to have this thought “I need more energy. How will I get through the afternoon?” Hence I end up feeling like snacking extra is the only way.

My current model is something like
C: afternoon feelings of tiredness while working
T: I need extra food, I need more energy to get through the afternoon otherwise won’t manage
F: urge
A: have snacks (sometimes higher carb though not always),
justify the off plan eating, tell myself I need to give myself something comforting and this is it as I feel so tired
R: the result is that I handle the problem with sleep and resulting tiredness through extra eating in the day

Any thoughts? Also ideas to improve sleep? It’s pretty random. Some nights I sleep well  (6/7 hours) others I wake like that.