You need a child theme for your custom code to customize the design of your website, but without touching the parent theme.
If you directly modify your parent theme, after an update, you would lose your changes.
So, fortunately, WordPress gives you the possibility to create a child theme. But is it really the best solution if your custom code is only for specific functions and not for the design?
Well, especially if you use a page builder or your code has nothing to do with the design, you would need a functional plugin that you can install on all websites where you need the same functions. Probably you will not create two sites with exactly the same design, but many times you need the same functions.