Then occasionally train with people faster than you! The key is to 1.) do this occasionally, like once per week in each discipline, and 2.) bust your ass to stay with the faster person or group.
I too often see athletes hook up with a group ride or run, and as the pace ratches up, instead of going with it, they drift off the back and do their own thing. I see this a bunch in cycling with those who aren't confident in their cycling. You'll see four or five triathletes spaced out by 200 meters or so riding along, when they could be in a group, working harder and also developing bike handling skills. Typically, they'll respond that triathlon is a solo sport and that you can't draft in a tri, so why do it in training. However, the real reason they are spread out is that they are either very nervous riding in a group or they don't like to work really hard. Yes, you can't and shouldn't draft in a race, however, if a stronger cyclist is making you work very hard to stay on their wheel, it's more often better training than if you were working it alone. Many will say that they just worked really hard on their own, but it's not the same. The way to find out what you have is to either race or train with someone faster who will really push you.
When I first began training for triathlon, I trained alone in cycling and running. I thought I was extremely fit until I hooked up with a weekly group ride with a bunch of roadies. I showed up in my cotton t-shirt ready to show these roadies a thing or two only to have my ass handed to me and get spit out the back 5 miles into the ride. It was humbling and an eye opener. I showed up the next week and worked at a level I had never reached in training trying to hang on. This time, I made it 10 miles before being left for dead. I showed up each week and did whatever I could to hang on for as long as I could, each time seeing new max heart rates and feeling burn in muscles I didn't know existed (and I was taking anatomy and physiology). A few months later and I was not only able to hang in there, but do more than my fair share of work at the front. In those few months, I saw my cycling fitness make gains that would have taken me more than a year had I gone at it alone.
I rode with an athlete I coach yesterday. We kept the pace strong for the ride, however, I really made her work the last 45 minutes. I could see and hear her pain, yet she stayed tough. She could have ended the pain very easily by just slowing down and drifting off, yet she didn't. And as much as she may have hated it during those 45 minutes, she was grinning and feeling great as we chatted afterwards in the parking lot. I organize a few group training sessions and myself, the group who show, and those I coach out of state are always amazed that very few take advantage of training with a group.