When do you use which? Is one method better than the other?
Code Snippets is typically used for adding code that does not involve adding directories and files on your server.
Whichever method you use, there is no right or wrong here.
Do note that there are some subtleties and adding the same exact code might work in one but not the other. Example.
Personally, I prefer using My Custom Functionality since I am quite comfortable working with code and edit the files using Visual Studio Code or Sublime Text.