mktemp
is probably the most versatile, especially if you plan to work with the file for a while.
You can also use a process substitution operator <()
if you only need the file temporarily as input to another command, e.g.:
$ diff <(echo hello world) <(echo foo bar)