Your habits are often a byproduct of convenience. Humans are wired to seek the path of least resistance, which means the most convenient option is often the one that wins. Make good choices more convenient and bad choices less so. Behavior will improve naturally.
James Clear, 3-2-1: On the Power of Quiet Moments, How to Make Good Habits Easy, and Starting the Year With Enthusiasm Read the source