Vanilla Ice was indeed sued by Queen, because he used the main riff from “Under Pressure” as the main riff for his song “Ice Ice Baby.”
Legally speaking, using samples is okay as long as the original recording is properly referenced, for instance in the liner notes. It’s called “clearing” and it’s the generally accepted practice.
Musically, sampling sucks.
But the riffs on Under Pressure and Ice Ice Baby were different - slightly. Sure, it sounded a LOT alike, but it wasn’t exactly the same.
Kind of like calling it Mikey Mouse, instead of Mickey Mouse.