Without knowing which database interface your using, it's difficult to do a proper prepared statement version of this code (I've added a mysqli_ version to the end of the answer).
he simple idea would be to explode()
the words according to spaces, then build a SQL statement based on splash58's comment. So...
$parts = explode(" ", $input);
$sql = "select * from Users where name like '%".
implode("%' or name like '%", $parts).
"%'";
echo $sql;
would give you
select * from Users where name like '%Rob%' or name like '%Doe%' or name like '%fred%'
If using mysqli_, then the following would use prepared statements with as many parts as you need...
$input = 'Rob Doe';
$parts = explode(" ", $input);
// Add %% around the word for the 'like'
array_walk($parts, function(&$part) { $part = "%".$part."%"; });
// Generate the bind types for mysqli_
$types = str_repeat("s", count($parts));
// Build sql with a ? for each word
$sql = "select * from Users where name like ".
implode(" or name like ", array_fill(0, count($parts), "?"));
$stmt = $conn->prepare( $sql );
// Bind the words to the SQL statement
$stmt->bind_param($types, ...$parts);
$stmt->execute();
// For example - just get an id from the user
$stmt->bind_result($id);
while ( $stmt->fetch() ) {
echo $id.PHP_EOL;
}