Search the entire file system for files with the name ending in ".foo" and print the results, then use the results to search for the phrase "stackoverflow" in those files.
find / -iname '*.foo' -print0 | xargs -0 grep -q stackoverflow