A mantra acts as a shield/gateway between body and mind, that we use to escape from one to the other.
A mantra possesses the latent power of word. If it's a meaningful word, phrase, etc., it can take us instantly to what it refers to (place, time, object, person ...), or it makes us strongly feel it (when it's a mood, emotion or abstract concept). If it's a simple meaningless sound, it gives relaxation.
A mantra filters out unnecessary emotions and thoughts, helping us better enjoy, relax and focus, mentally and physically, on the things we need only. It can be a double-edged weapon, numbing our senses temporarily, not feeling cold, heat, hunger, thirst, fatigue ... thus decreasing emotional and physical pain.
Although it doesn't involve much or deep thinking, it paves the way for it.
It boosts willpower, since it frees and directs our unused energy towards things we have difficulty doing.
A mantra equally helps achieve focus and distraction (diversion), depending on which we need, whether it's related or not to what we focus on. (Listening to a lesson, while repeating "this is great" or "this is boring," can help us gain or lose focus, respectively.)
However, a "misused mantra" can turn into an obsession, causing mind stiffness (literally and negatively). For this, a mantra should only be used for a purpose, temporarily, to lead to a deeper meaningful thought or a pleasant fantasy, or to relax before work or sleep, or to overcome anger or any harmful urge until it goes away ... After a mantra has done its job, we proceed with other things in life.
ANY sound, word or thought can become a mantra. We can replace a mantra by thinking aloud, repeating thoughts, mindless reading, or just "hearing" ourselves think, and repeating such thoughts enjoying their mere sound in our head (till we are ready to take them seriously, or think or do something else, or think or do nothing: resting or sleeping: Zzzz ... that's soothing too.)
Longer texts read for relaxation vary too. Many Christians recite psalms or short prayers. Muslims read Koranic suras. Both the secular and religious can read or recall poems, which already include thoughts, images, music ... within. Some use counting too for relaxation (it's pointless, although toddlers find it exciting).
Our mind can greatly benefit from words, having full control over our life by being intentionally verbal. Even in "non-verbal thinking" when we put our self-control and consciousness aside (as in free fantasy, meditation, sleep preparation ...), we can still use verbal thinking IF the ideas used are soothing enough (recalling good times, counting one's blessings/achievements, sweet-talking to oneself, forgiving oneself, etc.) Otherwise, meditating, relaxing or falling asleep directly, without thinking, is better.
The Power of Word
Some scientists rate language as the greatest invention of civilization in the last 30,000 years or so. No wonder:
Once the function of words is over, they transform into fantasies, representing the reference each word has in our brain's dictionary. Then into thoughts, resulting from the proximity of such references together. Then finally into actions, relating each thought to its physical representation in the world, that can bring tangible change to our life.
Otherwise, to repeat words and mantras without purpose, or to be totally absorbed in thoughts without actions, even with one's duty calling or an imminent danger approaching, one ends up like a dumb parrot, a lifeless robot, or a hopelessly broken stereo.