Overcoming bad habits is not just from the mindset is also by your actions, it can be tough to overcome bad habits but here are some ways i know that can make it easy for you to overcome bad habits.
firstly you can seek help from a therapist or someone who can help you with some good advice, also you can try to reward yourself in progress to overcome this habits, you can also participate in other activities just to keep yourself busy, and the last one is learn to surround yourself with people to keep yourself distracted. if you knw many other ways you can contribute to this let's discuss about that. Thank you