Chances are, those feelings are being generated by your erroneous thoughts:
They got the job you wanted = you lost the job.
Well, not quite.
Because not getting something is different than having something taken from you.
And it’s important to recognize that in only one of those scenarios have you suffered an actual loss of anything.
Which means in only one of those scenarios is any “suffering” necessary.
It’s totally understandable to feel disappointed that you didn’t get what you wanted, but putting yourself through the emotional wringer of grieving a “phantom loss” is a huge and unnecessary expenditure of your energy.
(Plus, all that misplaced suffering interferes with your opportunity to practice feeling genuinely happy for someone else’s gain.)