Both have similar meanings but are differences between informal and honorifics.
"고마워" is mostly used when your opponent's age is same or younger than you. It means, Informal. When used for more polite and When your Opponent older than you, It changes using as "고마워요" or "감사해요".
"감사해요." or "감사합니다." is always used when you thank someone older than you or unknown people and it's Honorific for 'Thanks'.