Dealing with betrayal or rejection

I have kept this question as general as possible on purpose. However, if I perceive myself to have been “betrayed” or “rejected,” I feel undesirable, unwanted and unworthy. Writing these words out reminds me that it is probably very human to feel negative emotions about these situations. While I understand that these types of situations may never be completely comfortable, how can I make the hurt less deep without necessarily making it mean something negative or unlovable about the other person but also believable to myself? How can I make it mean something that allows me to keep my own integrity and value as a person without infringing on the integrity of the other person?