Well, if you're searching for *nick* and the nick is any part of any of the "bad" words, then it will be a problem. So, any small nicks risk being banned.
If nothing else, you can throw into that IF statement...
&& $len($nick > 2)
Of course, that still risks having someone with a nick like amn being banned. But, there are probably few 3+ letter nicks that would get banned because they are part of a larger "bad" word.
There is one really bad thing with how you're doing this, though. You're looking for *nick*... Let's say a "bad" word you had was "ice." Yes, it's not a bad word, but I'd rather not start writing real ones in here and it's just an example. Anyhow, if someone's nick was "mice", it would search your bad word list for *mice* and wouldn't trigger for "ice". Think of that with how people may use swear words ... dumb*** as an example. If you put that one in your list of bad words, it would be fine... but if you just put in the * part in your list, then it would fail. Considering how many ways people use words, it would be a pain to enter every single possibility.
You're better off checking every bad word against the nick instead of the nick against every bad word. That's not a good thing to do using a text file as reading it will be a pain... you may be better off using a hash table or just sticking the words directly into the script.