What is subroutine

Wikipedia:

In computer programming, a subroutine is a sequence of program instructions that performs a specific task, packaged as a unit.
This unit can then be used in programs wherever that particular task should be performed

More: https://cs.lmu.edu/~ray/notes/subroutines/

What is the difference between function and subroutine?

Functions and subroutines are called in the same way. 
The only difference between functions and subroutines is that functions must return data, 
whereas subroutines need not. ... If you call an internal routine as a function, you must specify an expression 
in any RETURN instruction so that the routine can return.

More: https://www.oorexx.org/docs/rexxref/x23401.htm