Thank you is standard, could be said to anyone, young old, familiar, unfamiliar. It also expresses greater gratitude than a simple thanks.
Thanks is more informal, too.
So if someone offers you a homemade cookie, you can say simply thanks, especially if you know this person. Or it`s a stranger but the same age, let`s say.
But if someone donates their kidney to you (just making a point) you can`t just say Thanks.