Minecraft wiki entry for function, associated text: In Java Edition:
To run a function located at data/custom/functions/example/test.mcfunction in a loaded data pack: /function custom:example/test
To run all functions in a function tag located at data/custom/tags/functions/example/test.json: /function #custom:example/test
To run a function if there is a sheep within a radius of 2 blocks: /execute if entity @e[type=sheep,distance=..2] run function custom:example/test
To run a function unless the executor is a player: /execute unless entity @s[type=player] run function custom:example/test