In standard, the only thing it has over Donphan is Swords Dance, while Donphan has better stats everywhere except in Speed, plus Roar. Therefore, when using Sandslash in standard, use Swords Dance. It's not a bad Pokémon there, maybe even a tad underrated, a Swords Danced Earthquake does about 70% to Milotic and minimally 60% to Swampert. It resists Rock Slide from Tyranitar and Aerodactyl pretty well, you may want to try it out sometime.
In UU, Sandslash is a monster. It rivals Quagsire and Gligar as the best Ground around. It can 2HKO Quagsire and Blastoise with a Swords Dance, and if Gligar comes in on a Swords Dance it can take it out one on one, barring Toxic. Its great Defense and the use of Hidden Power Ghost or Rock makes it an alright Solrock switch-in (though Reflect will be annoying), and it can hurt its counters quite well. Be aware of Sandslash's great sweeping powers, whether you're using it or not.
This set is recommended for both standard and UU play. Sandslash is easy to bring in on physical attacks, preferably a Rock Slide so it can spare some health. Hit your counters on the switch: Earthquake for Waters like Milotic, Swampert, Suicune in standard or Quagsire and Blastoise in UU, and Hidden Power Bug for Celebi in standard and Solrock in UU. Take note of how much damage you do. When they take two more hits to finish off, Swords Dance on the switch, then take them out.
Return helps to 2HKO most Gligar, but that's the only Pokémon it's hitting, so Rapid Spin is an option if you really want to get rid of Spikes. Don't use this set in OU, however, because Donphan outclasses it there.
This set is designed to specifically counter some of the biggest threats in the UU metagame, while still being able to get most of the 2HKOs and OHKOs that it needs to. Counter is a great addition to the sweeper set, as it allows Sandslash to destroy many of the Grass-type Pokemon which normally stop it, since their strongest move is Hidden Power Grass, which can be Countered. The basic strategy is to bring Sandslash in on a weak physical attack such as Rock Slide, or any Electric attack. Swords Dance on the switch and then start sweeping. This set allows you to take out Blastoise, Walrein, and Meganium - all common switch-ins to Sandslash -and continue sweeping what you can. Greedy Gligars also get taken out it they try to KO with only +2 or +4 Atk (depending on EVs and nature of the Gligar).
Another bonus is that with the 252 HP EVs, and 36 SpD EVs you always survive various STAB Surfs and Ice Beams, while being faster and being able to 2HKO. For example, you can Swords Dance on your opponent's switch to Walrein or Blastoise, and then hit it for a 2HKO with Rock Slide (only on Walrein) or Earthquake, and live through the Surf / Ice Beam to hit them for the KO. Additionally, Sandslash will always survive a Timid Manectric's Hidden Power even after a Petaya boost, as well as almost always surviving a Timid Electabuzz's Ice Punch after a Petaya boost.
Rock Slide is the preferred move in the 4th slot, because it has the flinch rate, and Sandslash is able to outspeed most walls. It also allows Sandslash to take out fliers and Levitators that would not take themselves out with Counter, such as Misdreavus and Xatu, but more importantly, Altaria (which is outsped by this variant of Sandslash, allowing you to Rock Slide and possibly flinch before you get hit with Haze or Perish Song). Furthermore, it helps with Scyther and Yanma, not allowing them to set up while you try to Counter. Hidden Power Bug hits Grass types that do not attack with Hidden Power Grass, such as Bellosom and Tangela, and can hit Meganium hard if it uses Light Screen or Leech Seed. Hidden Power Bug also hits Solrock / Lunatone for super effective damage. Hidden Power Ghost, on the other hand, hits not only the previously mentioned Lunatone / Solrock for super effective damage, but also Misdreavus and Xatu as well. Counter takes care of Fearow, so it is not a big trouble if it walls those two attacks. It should be noted, however, that Rock Slide does have lower accuracy than Hidden Power
A great example in standard is Snorlax: try coming in on a Curse. Snorlax might be afraid you're going to Swords Dance up on him and will try to attack you, and a Counter will put a big dent into him. It will also be of great use against Choice Banders such as Salamence in standard or Fearow in UU.
You can use Rest for that, but Sandslash may have a hard time surviving this without Heal Bell or Aromatherapy somewhere on your team. Same for UU, except that is even more fast-paced. Protect can be handy for lingering Toxic, gaining Leftovers recovery and scouting for Explosion or Choice Banded moves.
Focus Punch can come handy if Skarmory comes in on your Swords Dance, but usually it will not hurt anything more than Earthquake and Rock Slide together will. Flail simply doesn't work well as Sandslash doesn't have STAB on it and isn't fast enough to pull it off. Hidden Power Ghost hits Gengar and Misdreavus harder than Rock Slide, and still puts a dent into Celebi, Solrock and Lunatone, and Hidden Power Flying is an awesome option to scare Heracross and Breloom, and it still hits Celebi, so it's pretty useful when you're using this guy in standard. Sandslash makes an average Sleep Talker thanks to his great defense, but you'll be wasting his awesome Swords Dance potential, and the most common Sleep moves come from Milotic, Jynx and Grass-types, none of which Sandslash likes to face.
It outspeeds Blastoise with no Speed EVs, with the recommended spread, as well as anything slower (Hypno, Solrock, and anything else with 70 base or lower). You'll generally want a ton of Attack, with the rest of the EVs in HP.
If you're using Counter, you may want to take EVs from Attack and Speed and put them into HP.
Checks and Counters
Its biggest weakness is that it's slow and doesn't take special hits very well, but most special attackers do not take his Earthquakes that easily either.
In standard, Skarmory walls Sandslash to an extent. Toxic will mess it up badly, Spikes will hurt the team and Roar and Whirlwind negate Swords Dance. However, Sandslash can also Rapid Spin off the Spikes, and hit Skarmory with a Swords Danced Focus Punch, or try to wear it down with Rock Slide (Swords Danced Rock Slide does about 40%). Suicune, Milotic and Swampert can OHKO with Surf or Hydro Pump, and their high HP and Defense will be troublesome in the early stages. If their health falls below 50%, however, a Swords Danced Earthquake will kill all three of them (except a Bold max Defense max HP Suicune, who has a chance to survive). Salamence and Gyarados can be a pain with Intimidate and immunity to Earthquake, but unless they're using a Special Attack like Hydro Pump, Sandslash can just Swords Dance on the switch and beat them with Rock Slide. Claydol is immune to Earthquake and resists Rock Slide, and usually packs Toxic or a super effective Ice Beam, however he is 3HKOed by Hidden Power Ghost or Hidden Power Bug without Swords Dance. Zapdos and Raikou, as well as other Special Attackers that outspeed Sandslash, can come in on a non-attacking move or after Sandslash killed something to finish it off.
In UU, a Gligar with Counter or Toxic can mess up Sandslash somewhat, and Quagsire, Blastoise and Walrein can hold the boat to the same extent Suicune, Milotic and Swampert can in standard. Solrock can Reflect up and Lunatone can use Ice Beam, but they should beware of Hidden Power Ghost or Hidden Power Bug. Any STAB Water, Grass or Ice attack will (nearly) kill Sandslash. Meganium makes a great counter with Giga Drain, Razor Leaf or Hidden Power Grass, perhaps in company of Reflect and / or Leech Seed, but once again watch out for Hidden Power Bug. Make sure to use Synthesis to keep it alive.