If you keep on thinking about your problems or worries at night time while sleeping, then your mind won't be relaxed. You are more likely to get good sleep if you are relaxed in mind & body. Try to write down your worries on a piece of paper & allot a time during daytime to think about them.
It the thoughts are too much intrusive, then try to practice some relaxation techniques like deep breathing, positive imagery ; which will help you relax.
Even anxiety & depression can affect sleep.
Next Steps
If the other techniques don't help then, try to visit a counselor who may teach you some coping skills to deal with your problems.