Lots of ways, not all of them always successful, and it is hard! First and most important, I meal plan and make sure that I know I am having nutritious, tasty meals that should give me the food and nutrients I need, so any cravings are just my body protesting at losing weight OR my mind being bored and wanting a treat! So I try and rationalise the cravings away which works to a point.
Also, it's boring but it's really easy to mistake the feeling of thirst for hunger, and when you are dieting you take in less water through food so if you feel hungry immediately go and get yourself a big glass of water or a cup of tea or whatever you drink and have that and let it 'sink in' before even thinking about eating something. On the go always have a bottle of water with you and sip it every time you think about food, that should help resist temptation for snacks (also because you will be constantly needing a wee which will take your mind off it
). Also, when you are out, can you try and avoid having your purse with you unless you absolutely need it, I know personally I can't take any money with me to the park because I absolutely will stop at the ice cream stand in summer or the cafe for hot chocolate in winter, so making that impossible is the way to go...
Weirdly and I'm sure it's psychological, I find fizzy water more 'filling' than still
so I have a bottle of that on the go at home, sometimes I have it iced which slows me down a bit as well. After I've had my water I try and occupy myself as best I can, either an absorbing piece of work during the day or something like a bath or some craft work or something at night, to try and take my mind off it!
If that hasn't worked I have a few go-tos to try and address the sugary craving, I know people think it's a disgusting habit but chewing some sugar free gum works for me, its sweet and I can sort of pretend its a 'treat' plus the motion of chewing seems to trigger some kind of 'eating' reflex in the body and I feel less hungry after. Or (and again a lot of MN hate this), I do allow myself the odd diet coke or glass of sugar-free squash which is basically 0 cal, which can again hit both the sweet craving spot and the re-hydrating thing... MN more usually recommends fruit teas for the same effect which you could try also? If all else fails and the craving just won't go, I'd eat something but try and make it healthy not junk, either bring your next meal forward or have some fruit or a boiled egg or some cheese, something which will actually fill and satisfy you, not carby junk which will just leave you wanting more!
The cravings do tend to get better after a few weeks so you are probably going through the worst of it right now, so carry on! The best way for it to get better is just don't eat the stuff, as much as you possibly can, if you give up and binge not only are you setting your diet back but also putting yourself a step backwards with the sugar cravings so try and view it as helping your future self by saying no now, I know it's easier said than done though 
Re the DH thing, you have my sympathies, not to play top trumps but my DH is actually chronically underweight and somehow managed to lose more weight in the first lockdown - how??? And so for his own good he actually needs to eat 4 big meals a day and snacks in between, which is just torture for me on my crumby endless weight watching and ability to turn spherical just by looking at a bun
. It is rough but all I can suggest is I give him his own snack cupboard and don't ever ever look in there, I also try and make him eat his stuff in his study or anywhere away from me, he'd developed a habit of bringing his huge carby supper into bed and offering me a bit, that had to go
. I also try and eat very lightly in the day now so we can have a similar dinner, I just couldn't bear to sit and watch him eat his way through a huge portion of chips, cheese, sauces etc while I had a salad or something, torture...