Cursing itself is not illegal, as cursing is protected under the First Amendment and is considered freedom of speech.
However cursing can be illegal depending on the context, like the cursing is directed at a police officer or the cursing is part of fighting words or used in a broadcast.
Cursing at a cop or police itself is also not illegal, but it could get you arrested, especially if you curse at the cop or police in a threatening way.
Swearing or cursing at a police officer could lead to charges like disorderly conduct, or resisting arrest if you're already being arrested for something or you're cursing at the police when they are doing their job and you're obstructing.
Cursing could be perceived at a threat or used to disrupt the peace.
If the cursing language is threatening and is likely to provoke an immediate violent reaction, then it might not be protected by free speech and can be a crime.
The government can also regulate cursing and profanity in broadcast media, like radio and television.
Cursing can be a part of another crime, so the context matters, even if the cursing itself is not illegal.
For example, cursing that is combined with a physical threat can result in charges for assault.
In most cases, though cursing or swearing in public is not illegal, although it can be considered rude or inappropriate.
And owners and operators of private property and private spaces, like stores and shopping malls, etc can set their own rules on language use.
And the Supreme Court also has affirmed that people have the right to curse while criticizing government officials, including police officers, unless the speech becomes a threat or if it incites any violence.