The brain resolves problems. If you have a problem on which your thoughts are focused, your mind will be actively put to work. We can call that worry, perseverating, obsessing and other diminutive words. But if you realize that all that unsettling is really your mind trying to resolve the problem for you, wouldn't you think differently? Your mind is doing exactly what you want it to do, fix things.
Try this. When you can't sleep because your mind will not let go of a problem, get a pen and pad and write out the problem. Then write three to five possible solutions to that problem. Don't rule out every solution because of some minor detail. Write it anyway. Then write a few sentences for each solution about how possible it is. Write out all the fears and reliefs in each solution.
Finally, choose one solution you will be willing to start the next day.
Sit quietly for five minutes knowing you are on the way to have your problem resolved. Now turn out the light and slip into sleep.