Any time you want to use code as a GOSUB routine, you need to have it in your script. If you have many scripts, you need many copies of the same subroutine. Later, if you want to revise it, you need to find and update all the copies.

With UDFs, you can put as many of them as are practical in one file and the just CALL it.

See the FAQ:
Topic: How to use UDFs
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.