What is the right way to add PHP code to a certain part of a page

I know I can add PHP to the functions file. And I know I can make a plugin.

I basically need to make a calculator of sorts and send the values to an email signup.

What is the best way to achieve this. I think a plugin, but then how would I position the plugin at a place on an already existing page?

Sorry if this is a noob question, I really want to understand the correct way to achieve this before starting.