It's true that, so long as the exit is lower than the entrance, water will find its way through the pipe even if there are low points in the path. However, as others have noted, debris could accumulate in those low points. So the answer to your specific questions "does it need to be continuously sloped" is a squishy "yes.. unless you're willing to install mitigations."
One mitigation you could consider is one or more sump pits/traps/catch basins along the path. Here's a sketch from Dejana Industries:
This construction is specifically designed to catch debris in storm water systems. That's not what you're after, so we can modify the design a bit.
Run pipe with a continuous slope at a sufficiently steep grade so that debris will carry along well. When you reach a point that the pipe is getting too deep in the ground, install a catch basin there. Take an exit pipe out of the pit at a level higher than the inlet and proceed to the destination.
During a storm water will fill the catch basin. Eventually the water level will rise high enough to flow out the exit pipe. Some debris will settle in the basin; other debris will float up and flow out the exit.
Construct the basin to be leaky so that after the storm the water remaining in the basin slowly drains away. That'll minimize the chance of breeding mosquitos or odors. From time to time you'll have to clean out the debris from the bottom of the basin, but it's better to have it there than in some unknown and inaccessible section of pipe buried in the yard!