Best practice for handling functions

Just wondering what best practice is to keep php functions for partials out of the main functions file. For example, I have a function to handle an ajax form submission mailer that only seems to work when I put it in the functions.php file. Is there a better way to separate these functions into other files specific to the blade template/partial? I can’t seem to find any docs with practical examples like this.