It is legal and it can be effective. Is it ethical? Back before the '80s it was often considered disrespectful to use it and I never saw it on TV in Professional Tennis until the '80s. The first time I remember seeing it was Chang using it on Lendl in a final. He so flustered and angered Lendl that he ended up winning a match that he didn't look likely to win.
I used it in High School against those opponents standing back at the fence to bring them back in. I'd only resort to it if they were effectively soaking up my serves by backing up to the fence. I usually only employed it once a match and asked the opponent if they were ready before announcing the score and serving. I made the announcement so they couldn't claim that they weren't ready.
Now as a senior, it's almost like going nuclear if you use it against another senior. If you play someone younger and they use it, well they really want to win. If you use it first, then expect treatment in kind.
The better your slice serve and accuracy, the less you need this trick. It's good to have in your tool box though.