Meditation is an ancient practice, spanning back thousands of years and being done all over the world.
This 2019 study shows that meditation positively affects depression and anxiety, directly and indirectly affecting them.
You should focus on your breathing during meditation, trying to eliminate random thoughts that occur to you. Be present in the moment and only feel the physical sensation of your breath.
If your mind wanders off, take notice and bring your focus back to your breathing.