It's up to you, but in general I would say if a function affects a specific instance of an object it would be better as a custom action.
For example a "show game over" task is probably better as a function, and a "play object animation" task is probably better as a custom action.
It's a similar question as to whether to use a global function or class method in programming languages - often you can use either and the choice is a judgement.