It is important to distinguish between jealousy and envy. Jealousy is a fear of losing something that you have, envy is a desire for something that you don't have. I don't have enough information to be sure, but it seems as though envy more accurately represent your feeling. You desire something, and you feel as if you can't achieve it, and it frustrates you to see others that have it. You want to know how to prevent this feeling from ruining your mind. You can prevent this by reframing this feeling into a positive force for personal change. You desire something, and feel useless to achieve it. As Jonathan said previously, you are not entitled to everything. However, this doesn't mean you can't become more like a person who deserves these things. Find out why you are having trouble achieving the object of your desire. Use this information to motivate yourself to improve yourself in a way that makes you more deserving of these things. You say you feel useless, and that's a good start, because you now know what you need to begin improving yourself. Find out what it takes to become a person who is useful, and strive to become that. Then perhaps you will achieve that which you desire. Don't think you are helpless to become a better person, people are capable of improving themselves.
Just know that you have more that you think you have. Know that you are a valuable person, and that your friend should be honored to have a friend like you.It's okay to have feelings, but don't feel useless. You have a purpose. Live and find who and what makes you happy. If this person is always making you feel bad or jealous, they may not need to be in your life.