What potential pitfalls should be considered when using PHP functions like explode and substr to manipulate strings?

When using PHP functions like explode and substr to manipulate strings, potential pitfalls to consider include handling edge cases where the input string may not match the expected format, ensuring proper error handling for cases where the function returns unexpected results, and being mindful of performance implications when working with large strings.

// Example of error handling when using explode
$string = "Hello World";
$parts = explode(" ", $string);

if(count($parts) < 2) {
    // Handle error or provide default behavior
    echo "Invalid string format";
} else {
    // Continue processing with the expected parts
    echo "First word: " . $parts[0];
}