This list has been updated for Big Sur (and later). Since I don't use these versions, this guide might still need further improvements. For older macOS versions, please see this older revision.
- Open Automator
 - Quick Action
 - Set “Service receives selected” to 
files or foldersinany application - Add a 
Run Shell Scriptaction - Set the script action to 
/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@" - Set “Pass input” to 
as arguments