Because we are all different and at various fitness levels, it’s extremely hard to keep up with someone who is fitter than you. It can sometimes de-motivate you. And getting fitter is meant to motivate and not make you feel like a failure.
Work yourself to exhaustion. Sounds weird but my exhaustion is different to yours. Even if you are at 100 and someone else is hitting the 300 mark, your body is increasing in strength and endurance. It’s doing its thing to the best it can and as long as you are doing the correct exercises, correct technique and full range of motion & avoiding cheating, you are getting better and better each time.
You don’t want to overdo it and you don’t want to get injured. The gym, can be extremely competitive. That environment works for some. But I know many people who find it difficult. So find a gym or training programme that works for you. There is nothing wrong with being pushed and being encouraged to go harder. Just know that though you aren’t running 10 k’s right now, you will be. Don’t try to beat the best if your body is saying I’m not ready yet. Work yourself just past past the level of saying “I can’t do anymore” and see how you improve at the next training session.