Generally, I use "here you are" when giving something to someone that they person had asked for.
Person A: Can I have a cup of tea?
Person B: Sure
Here you are! (passing the tea)
Here you go would also sound natural here. It's not a strict set of rules for using them. It more what sounds most natural. Of course I'm referring to English English, not American English here so I am not sure if there are any differences between the two countries regarding this.