While the terms "dune buggy" and "sand rail" are used interchangeably, they both refer to small open top off-road vehicles similar to go-carts that can traverse though rough terrain.
Dune Buggy
A dune buggy is a recreational vehicle with large, wide tires that are designed for use on beaches or sand dunes. To increase the power-to-weight ratio, dune buggies are designed with either more engine power, a lighter frame, or both.
The vehicle featured in the images below is a restored 1970s Myers Manx fiberglass dune buggy that's street legal.
Dune buggies typically feature open chassis, modified from an existing vehicle. The older Volkswagen Bug is a popular choice with the rear-mounted engine and robust front suspension.
Sand Rail
Sand rails on the other hand, are built from a tubular open frame chassis that has an incorporated roll cage similar to modern UTVs and side-by-sides. The vehicle featured in the images below is a Toyota 22R sand rail.
You typically won't find windows, doors, or even body panels on sand rails, and they almost always have rear wheel drive. Many times this will cause the rail to tilt upward and lift up to glide over the sand.
To Conclude
The terms "dune buggy" and "sand rail" do refer to two different types of vehicles. However, many people refer to sand rails as dune buggies since it's a buggy-style vehicle that rips through sand dunes.
It is an important distinction to make, although it's up to you what you want to call your vehicle. Many find that beginners to the sport will refer to sand rails as dune buggies, when in fact they are actually referring to a sand rail.
The long history of the term "dune buggy" has stuck from the 1970s style rebuilt VWs and continues today in common language when mentioning an off-road vehicle built to traverse through rough terrain.