I've found this is difficult for me. It's much easier to not eat those foods at all than to hope to only eat "a little".
A mitigation is only buying very small packs, but that's not always practical.
My theory: diet soda has no high fructose corn syrup, so it feels thinner (less viscous and sticky).
But this is the whole difficulty about it. It's very hard to stick to a diet when there is so much temptation in the world. If you can have your aspartame cake and eat it, why wouldn't you?
https://jamanetwork.com/journals/jamainternalmedicine/fullar...
Almost every advancement in dietary knowledge I have see over my life has indicated more and more that excess sugar (and carbs in general) is by far the biggest problem all over the world. And it is trivial to consume excess carbs with a modern lifestyle in a developed country.