Prevent post from being published and show error

The argument syntax in your strpos() call is such that it’s testing the content for the literal string “$words” instead of the content of the $words variable.

publish_post action hooks do not directly receive a post’s content as an argument. However if you use the provided arguments as detailed by the documentation, it is not necessary to retrieve the $post global.

To test for multiple words, the easiest solution may be to place the words in an array, then loop through it to test each individually.

If you don’t care about conveying which prohibited words were discovered, you can wp_die() within the loop as soon as any word is found. It may be more useful to test them all and tell the end-user which were discovered, however.

All together:

function jhnppWord( $post_id, $post ) {
  $prohibited_words = array(
    'foo',
    'bar',
    'baz',
    'baq',
  );
  $found_words      = array();
  $content          = $post->post_content;

  foreach( $prohibited_words as $word ) {
    if( strpos( $content, $word ) !== false )
      $found_words[] = $word;
  }

  if( count( $found_words ) === 0 )
    return;

  wp_die(
    sprintf(
      __(
        'Your post contains words that we do not allow ("%s"). Please remove them and try again.',
        'jhnpp'
      ),
      implode( '", "', $found_words )
    )
  );
}

add_action( 'publish_post', 'jhnppWord', 10, 2 );

Instead of hard-terminating the publish request, a more user-friendly alternative may be to revert the transition to publish-status and set a message to be displayed within the dashboard UI, and/or implement the test in JavaScript to provide feedback prior to the user submitting the post.

tech