On a map like Cheep Cheep Beach, there's sections with both land and sea driving. The land driving involves several twists and turns when you could make a more direct route through the water. Is there a downside to driving underwater versus driving on land?
In general, your kart will be slower under water than on land, so it's preferred to take the dry road if you're given the option. Specifically, you have a higher max speed on land and when you transition from water to land, you'll need to accelerate to reach your top speed again.
Based on your kart configuration, you may be able to counteract this effect to some degree if desired. Looking at the list of vehicle modifications, some karts like the Landship specifically have a lower than average land speed with a higher than average speed under water. However, many tire types have reduced underwater speed. Based on your preferred kart parts, your kart may perform better on one path over the other, so the best way to determine the optimal path for sure is to compare a few run times in a controlled environment like time trials with different vehicle layouts.
Note: At the time of this writing, the game is very new so many parts' statistics have not been filled out yet. Many may be similar to their stats from the Wii U game, but this is NOT guaranteed. Notably, most gliders have changed to be much more varied.