My horse is great at trail riding alone, but as soon as another horse starts going faster in front of her, she'll buck and head toss until she gets to race in front. Any advice?

I would have her go in a circle, the opposite direction, or some halt work.
I would asking her to back up. Create an atmosphere where when she wants to race ahead ask her to do the opposite. As soon as she calms down ask her to walk forward.
She's also fine with walking behind other horses, sometimes trotting. But if she loses sight of just one of them, or anyone starts cantering, she loses her mind. Crow hopping, bucking, rooting, head tossing. She's not a "herd bound" horse on any other occasion.
Join the fun and sign up to connect with our 200,000 members!