It is common to be scared or sad if you are told that someone you care about is hurting yourself and feeling bad. There is much you can do to help the person. You can talk about how they feel, listen and help seek help if needed. You may need help yourself in order to be a good support and to feel good yourself.
Making yourself ill is usually a way of trying to deal with difficult feelings. It may feel like it helps in the moment, but in the long run it can make you feel worse. There are other ways to feel better, and there is help to get.