Pipe has the advantage of a smooth surface on the inside compared to the ridged interior of flexible duct. The smooth interior ensures that all of the lint from the dryer leaves the house. Lint trapped in the line, especially near the heat of the dryer, could ignite and cause a fire. A build-up of lint could block the venting line completely. This could cause the dryer discharge to back up into your home. If you have a long line of duct to vent the dryer, you could void the warranty on your dryer due to the risk of lint build-up in the line.
Flexible duct is easier to install, especially when moving around corners. Rigid pipe must be cut and fitted with elbow joints to move around corners. Check with your local code because some regulate the length of the run from the dryer to the exit vent, and others do not permit the use of flexible duct for venting a dryer.
Aluminum or galvanized steel pipe has the strength advantage over lightweight duct. If something falls on a pipe, it will not compress the line. Flexible duct is made of lightweight aluminum or vinyl with a supporting structure of rings to hold open the shape, but the rings can be bent and the duct twisted, causing a blockage in the line. Always check the run for the dryer vent to prevent obstructions.
Your choice of pipe or duct must be at least 4 inches in diameter. The length of the run should be the shortest distance possible to the exterior vent, and at a steep angle so the lint rolls down the line and does not get stuck. Consider raising the dryer 15 inches off the floor to make a steep slope for a downward vent. Raising the dryer will also make loading models with the door on the side easier.