Stealth Rock has much more distribution than Spikes. The most viable, or should I say the only viable Spikers in the National Dex OU metagame are Ferrothorn, Skarmory, and Greninja. Other Spikers like Mew, Garbodor, Smeargle, and Accelgor, are obviously not cut out for the job thanks to their inferior tiering. Some viable Pokemon with access to Spikes, such as Cloyster and Diggersby, don't even use the move that often. Meanwhile, Stealth Rock has a vast amount of viable setters, such as Ferrothorn, Heatran, Landorus-T, Skarmory, Clefable, Mega Swampert, Excadrill, and Tyranitar.
As Primal said, Levitating Pokemon and Flying types don't mind Spikes at all. Why did you think Flygon was so popular in Gen 3 OU? It was immune to them thanks to Levitate (also immune to Sandstorm). There are a host of dangerous Levitating Pokemon and Flying types. Hydreigon, Lati twins and their Megas (important because Mega Latias is one of the most important and dangerous bulky offensive threats in the entire metagame, so any bit of chip damage matters), and don't think I forgot Rotom forms, which couldn't care less about Spikes and also have Volt Switch. As for Flying types, dangerous mons like Mega Charizard Y, Zapdos, Pelipper, and Tornadous-T are Flying types, therefore being weak to Stealth Rock and immune to Spikes. Zapdos and Tornadous-T are generally bulky Pokemon so Stealth Rock is important to wear them down (unless they have Heavy-Duty Boots).
Rock is a good offensive typing, and Stealth Rocks exert a lot of pressure on offensive Pokemon
The Rock type hits a good amount of Pokemon neutrally and not too many resist it. Stealth Rocks benefit from this greatly. Stealth Rocks are much, much more consistent than Spikes, 3 Spikes = 1 super-effective Stealth Rock. As for pressure exertion, Stealth Rock can punish Volt Switch, Flip Turn, and U-turn attempts. Volt Switch's most common user is the levitating Rotom forms, and U-turn is commonly seen on the Flying type Landorus-T. Stealth Rock weak mons in general include the dangerous Sun Charizard, Volcarona, Cinderace, Moltres, Zapdos, Mantine, and Pelipper. All of these Pokemon frequently run Heavy-Duty Boots, getting rid of gradual recovery or a power boost.
Single-turn effectiveness (thanks to PhailRaptor for pointing that out)
Spikes need to be used three times to really do much. Stealth Rock only needs to be used once. 3 Spikes turns is a big disadvantage for you, since the opposing Pokemon can just set up a boosting move, use Substitute, taunt you, or just flat-out destroy you.
However, all this doesn't mean Spikes are bad
At least 50% of what made Klefki so good in Gen 6 AG were Spikes, which were notoriously powerful in the high tiers thanks to most Pokemon resident to Ubers being grounded. Prankster let Klefki get up at least 1 layer. Part of the reason why Greninja got banned from Gen 6 OU is because it could punish electric moves like Rotom's Volt Switch and Zapdos and Thundurus's Thunderbolt by Spiking in front of them, becoming Ground type thanks to Protean and thus becoming immune to Electric type moves. Although you mentioned Spikes and Stealth Rock, I would like to mention Toxic Spikes for a little bit.
Hope this helps!