How do you deal with selfish and egoistic people?

The first thing to keep in mind is that their selfishness, though it may cause problems for you and for others, is their problem, not yours. You aren’t obligated to change them, and you don’t need to take their selfishness personally. Think of it like bad weather: it may cause you problems, but it isn’t personal, and you often can’t do much about it. The next thing is to set clear boundaries. Selfish people will often push or manipulate you into doing things you later resent or regret. You can say no. You can even say no over and over again. You can also put some distance between you and them. Sometimes that’s not an easy option: it’s a family member, a boss, a friend of a friend, someone that’s hard to avoid. You always have a right to set limits, though, and if someone’s selfishness is harmful, keep yourself safe by getting away from them.