The xargs command takes the standard input and uses it as the arguments of the command: for example the command
find . -name \*.txt | xargs grep pattern
will find all the .txt files in the current working directory, their name are passed to xargs from standard input (through the pipe) and the grep command is executed for every file. In other words: find is executed first, its standard ouput becomes the standard input of xargs (this is the way a pipe works) and xargs executes the grep command taking the arguments from the standard input.