Two kinds of self-worth
What does it mean: for a human being to have worth? Why is self-worth so critical to mental well-being? How do we build or restore self-worth?
Therapists and religions suggest that humans have base worth by virtue of existing. I used to struggle with this, given the obvious differences in value society places on different humans (eg. prisoners, homeless, people with disabilities, fat people, orphans.) Now, I think the problem lies in confused terminology.
Maslow's hierarchy of needs, for example, considers self-esteem to be a separate, fourth need / layer. That's inaccurate. Self-worth is actually a byproduct of its neighbouring layers. We mix them up because they trigger a similar negative feeling, but that's a symptom: one should treat the underlying causes.
Self-esteem and belonging
Self-esteem (what Maslow termed "lower" self-esteem) is a lag metric of belonging (third layer). People who have good reasons to fear they would be abandoned when in trouble, chase attention, status, and prestige. They are directly motivated by a need of self-esteem; this is because humans are generally poor at planning for future needs ("I'll exercise tomorrow"), so they seem to have evolved a present-time substitute promoting social bonding.
As a lag metric, this kind of worth is easy to measure, but hard to influence: this is why comparison to others reliably lowers our mood. It is not easy to rise in status, fame, or develop new relationships, and there are no obvious steps to take which would guarantee success.
However, since our experiences are filtered through childhood mental patterns, we can suffer from inaccurately low self-esteem as a consequence of insecure attachment. This is theoretically fixable with therapy.
Belonging self-esteem is heritable, and available throughout the life of an individual, first through a relationship of a child with their parents and older family members, later through friendships, partnership, and community participation, shared cultural background, and lastly through elder care provided by younger family members.
Self-esteem and self-actualisation
Maslow's "higher" self-esteem is a lead metric of self-actualisation. It is related to feelings of competence, self-efficacy, and independence. Secondarily, it is also related to productivity, and one's work having value.
As a lead metric, it is hard to measure, causing the Dunning-Kruger effect. On the other hand, it is easy to increase by becoming proficient at something, which is why chief advice for "I have no partner/friends, and I'm struggling with loneliness" is "hit the gym, take care of your appearance, pick up a hobby". It does not solve the social problem, but it hits the same emotional buttons.
Competence-based self-esteem is hard to acquire during childhood - this is why children insist on participating in "adult" activities and attempt to contribute to the household. It declines while aging, during times of infirmity, job loss, and similar hardships, causing shame and fear of "becoming a burden".
People who have few strong relationships, either by choice (temperament or dismissive-avoidant attachment), circumstance (immigration), or lack of skill, balance it out with greater commitment to professional development and to hobbies. As a side effect, employees who are immigrants or have not started families may exhibit stronger loyalty towards their workplace and work colleagues, which can make employers prefer them over others. This is why proving parent's work ethics does not wholly combat this kind of discrimination.