When you focus on trying not to do something, you often end up doing the very thing you wanted to avoid. This can be partly explained by the Reticular Activating System (RAS). The RAS is a part of your brain that filters information and directs your attention to what you focus on most. When you try not to do something, your brain still focuses on it, making it more likely to stay in your thoughts and influence your actions.
Rather than fixing our attention on what we do not want to do, Scripture directs us to set our minds on what is good. We have the mind of Christ. When you focus less on stopping a problem and more on the God who fixes them, your thinking begins to change, and what once dominated your focus loses its influence.