Saying a ‘naughty’ word is generally just crude. If nobody was about to hear it, then it doesn’t matter. If it’s a common word amongst people surrounding you, then it’s simply colloquial. If it’s something that you wouldn’t say in front of your grandmother because she would be offended, then don’t say it in front of your grandmother otherwise you cause offence but that would be a venial matter.
I have a friend who is a good and holy priest and he occasionally uses swear words when in my presence. He certainly wouldn’t do so on the street or in the company of others, but he knows it doesn’t offend me. It’s just part of the language, albeit a bit crude, but then sometimes crude words give vent to crude feelings. Provided one doesn’t deliberately set out to offend or do so carelessly, then it’s nothing to worry about. Just don’t make a habit of it, otherwise the risk of accidental crude utterances in inappropriate places will increase.