How to keep your custom functions from being overwritten after an update?

There are 2 things you can do to keep your custom theme functions even after a theme update.

1) Use a child theme

A WordPress child theme is a sub-theme that inherits all the functionality, features, and style of its parent theme. When the parent theme gets updated, changes made in the child theme are preserved and applied on the updated version as well, including custom CSS and functions.

2) Use a code manager plugin
You can also use code manager plugins like Code Snippets to add your custom functions. Instead of storing it in the theme’s functions.php file, the snippets are stored in the WordPress database, independent of the theme and unaffected by WordPress upgrades or theme updates. Even if the code snippet plugin was accidentally deactivated, it will not remove any of your custom functions.