I had a 1996 GMC truck that did that. Step on the gas pedal and it would rev up but didn't go any faster. Let off the gas and then apply slowly and it ran fine.

It was the 700R4 transmission that was causing the problem.