There are few examples:
I am going there for you
I am giving this to you
You can’t give something for someone
You can give something TO someone
I am giving my pen to you
I gave money back to Freddy
But
I’m giving you this present for James (means you take it to give it to James)
I will pay FOR you, if you have no money
I will pay to you for your job
I return you money for Daniel
You can go TO the library
If you go somewhere FOR something, the meaning is “I have a goal”
Go for it
You can go there for your dreams
You gonna go to Friday’s to have some good meal