Like many words that get popular attention, the definition of "ego" has been distorted and diluted.
In psychological terms, our ego begins as an awareness of ourself as a separate (from our mother) person. After that our ego becomes the liaison between our internal world (our mind) and the external world (other people).
Much of that liaison work is the ego acting as an interpreter between those two worlds, although it also (especially as we get older) acts as a shield that protects sensitive parts of us.
Self-esteem and ego are often talked about together since they tend to rise and fall together. When my self esteem is threatened, it’s my ego that reacts and responds.