Yes, this is one way to get the first line of output from a command.
If the command outputs something to the standard error that you would like to capture in the same way, you need to redirect the standard error of the command to the standard output stream:
utility 2>&1 | head -n 1
, sed q ( ) sed -n 1p ( ).