Currently the while condition reads the same line from the file each iteration. It would make more sense to read only once

on @*:text:*:#:{
  if ($nick !isop #) {
    tokenize 32 $read(swear.txt,1)
    set -ln %text $1-
    scon -r if ( $* isin % $+ text) $({,) ban -ku180 # $nick No swearing $(| halt },)

Since each word in the file is re-evaluated with /scon, this assumes there is nothing in there that will be treated as code