I think what you’re trying to do could be achieved in a simpler form:
<span class="search-examples">Try to search:
<span><?php echo a::first($page->header_search_terms()->split()->shuffle()) ?></span>
</span>
You can chain shuffle without passing an argument. It will take the current chained collection as an argument.
You don’t need to do a foreach loop if your aray only contains one item.
a::first is a toolkit function that returns the first element of an array: https://getkirby.com/docs/toolkit/api/a/first
shuffle() does not take any arguments or expect collections, but it is a method of collections (= not a method of arrays).
I’m sure that’s what you meant, just being nitpicky.