Arjuna, the one who judges by comparison with himself and sees pleasure or pain everywhere as the same is held to be the highest yogi.
आत्मौपम्येन सर्वत्र समं पश्यति योऽर्जुन।सुखं वा यदि वा दुःखं स योगी परमो मतः॥
In plain words
Someone near you is struggling, and you are deciding how to respond. Compassion ranks above every other duty, and the way to measure another's pain is by your own. What grows from gentleness lasts, while fortune built on cruelty ruins itself.
The longer answer
When someone near you struggles, the first feeling is often helplessness, or a wish to fix everything. These lines start lower and simpler. They say there is no duty higher than compassion, and they picture a person who bears ill will toward no creature, who is friendly and kind, patient, and the same in pain and pleasure.
One line goes so far as to ask what need there is of knowledge, of final freedom, of matted hair or a coat of ash, for a person whose heart melts with compassion toward all creatures. Another lists the parts of a good life as if they were family: truth a mother, knowledge a father, compassion a friend, peace a wife, forbearance a son. Compassion, in that picture, is a companion you keep close.
This helps because it removes the pressure to solve everything. A kind act, chosen by imagining yourself in their place, is already the duty ranked first here.
What to do next
TodayPicture yourself in their place, then do one kind thing for them.
This weekAsk the person directly what would help most, and do exactly that one thing.
If it keeps coming backIf their struggle keeps deepening, help them reach a doctor or counselor, and keep standing by them while they do.
What the books say together
What this topic means in the books, in our own words.
Compassion is kindness toward every living being, and the books treat it as a duty. Chanakya Niti says no duty is higher than compassion, the Brihadaranyaka Upanishad hears the thunder repeat a call to be compassionate, and the Dasbodh selection makes it practical: learn another's sorrow, and at least share it by listening.
harmlessness, truthfulness, freedom from anger, renunciation, calm, freedom from slander, compassion for beings, freedom from greed, gentleness, modesty and steadiness;
Seers whose impurities are worn away, whose doubts are cut, who are self-controlled and delight in the welfare of all beings, attain the peace of Brahman.
Brahman: usually the one reality behind all things; in places, primal nature or the Veda
alert, deep, steadfast, master of the six waves (hunger, thirst, grief, delusion, old age and death), seeking no honor yet giving honor to others, capable, friendly, compassionate and wise.
अहिंसा सत्यमस्तेयमकामक्रोधलोभता ।भूतप्रियहितेहा च धर्मोऽयं सार्ववर्णिकः॥
Non-violence, truth, not stealing, freedom from lust, anger and greed, and working for the happiness and welfare of all beings: this dharma is common to every class.
dharma: right conduct and duty; as a name, the god Dharma, father of Yudhishthira
The Lord said: Compassionate, bearing ill will toward none, patient with all living beings, true to the core, blameless in mind, even-handed and helpful to all;
निष्किञ्चना मय्यनुरक्तचेतसःशांता महांतोऽखिलजीववत्सलाः ।कामैरनालब्धधियो जुषन्ति तेयन्नैरपेक्ष्यं न विदुः सुखं मम॥
Those who own nothing, whose hearts are attached to me, calm, great-souled, loving toward every living being, minds untouched by desires, enjoy my happiness of wanting nothing, which others do not know.
Celibacy, austerity, purity, contentment and friendliness to all beings are for everyone, and for the householder, going to his wife only in her season; for all, the worship of me.
Calm, self-control, forbearance, discernment, austerity, truth, compassion, memory, contentment, generosity, freedom from craving, faith, modesty, charity and the like, and inner joy belong to sattva.
sattva: goodness and clarity, one of the three strands of nature
तदेतदेवैषा दैवी वागनुवदति स्तनयित्नुर्द द द इति दाम्यत दत्त दयध्वमिति तदेतत्त्रयं शिक्षेद्दमं दानं दयामिति ॥
The divine voice of the thunder repeats the same: Da, Da, Da, that is, restrain yourselves, give, be compassionate. One should learn these three: self-restraint, giving, compassion.
That is no strength which opposes gentleness; a blended course of dharma should be pursued with vigor; fortune built on cruelty is ruinous, while fortune grown through gentleness passes to sons and grandsons.
dharma: right conduct and duty; as a name, the god Dharma, father of Yudhishthira
The ear is graced by learning, not by an earring; the hand by giving, not by a bracelet; the body of the compassionate by helping others, not by sandal paste.