<?php
$words = 'good
bad
cupid
banana
apple';
$text = 'Sometimes I travel to the good places that are good, and never the bad places that are bad. For example I want to visit the heavens and meet a cupid eating an apple. Perhaps I will see mythological creatures eating other fruits like apples, bananas, and other good fruits.';
$expr = explode("\n", $words);
$expr = array_map(function ($v) { return preg_quote(trim($v)); }, $expr);
$expr = '/('. implode('|', $expr) . ')/i';
preg_match_all($expr, $text, $matches);
var_dump($matches);