In the context of PHP string manipulation, what are some potential pitfalls to avoid when using functions like explode() and trim()?

When using functions like explode() and trim() in PHP string manipulation, some potential pitfalls to avoid include not checking if the input string is empty before performing the operation, not handling cases where the delimiter or characters to trim are not present in the string, and not properly sanitizing user input to prevent unexpected behavior.

// Example of checking if input string is empty before using explode()
$inputString = "Hello, World!";
if(!empty($inputString)){
    $explodedArray = explode(",", $inputString);
    print_r($explodedArray);
} else {
    echo "Input string is empty.";
}