They can be. But, they’re not the right fix for your problem.
If your feet slip off the pedals, it’s almost certainly because you’re not weighting them right, and not moving effectively with the bike. If you switch to SPDs, obviously they can’t slip off but you’ll not fix the technique problem. And that’ll still have an impact on your control of the bike. Not ideal.
(though, it could also be a pedal issue to be fair- what are you using now?)
I’m a flats user, no choice in the matter but I honestly reckon SPDs are better than flats in most circumstances. However personal taste is far more important than what’s “better” unless you fancy yourself as an elite racer.