It is unclear whether your engine speed increases or decreases when the problem occurs, "tries to rev up" needs clarification.
It sound like you may have a failing upstream oxygen senor. I have seen a problem with the 4.0 liter Jeeps of that period where during the first 2 minutes of operation, before the O2 sensor is hot it sends a false signal to the PCM and results in a lean operating condition. The engine will bog down or fall flat when trying to accelerate, the engine will not rev up. After a few minutes the O2 sensor is hot and the problem will be gone.