You see, Sora, having a fairly large crush on Kairi, always imagined the two of them together, but when he’s actually with Kairi, he Can Not Spit It Out. Boys, how many times have you approached the gal of your dreams only to act like a total idiot and either fumble with words, or act completely uninterested? So he does the only thing he can think of without looking stupid; just hug her back.
Meanwhile with Riku, Sora’s letting out all of the worry he’s had over Riku being consumed by the Darkness. Wouldn’t you be worried if your best friend was turning evil? or had a pretty good chance of being lost to the Darkness forever? Sora’s just relieved to see he’s okay, and also a little pissed that Riku didn’t tell him he was in the first place. He isn’t gay, just extremely worried for his friends, which fits with his personality perfectly.
It is also worth mentioning that despite being separated, Kairi spent that year safe at their homeworld. Riku, in the other hand, was thought to be lost forever, and while Sora knew Riku was back for a while thanks to Mickey, finally meeting with Riku cracked him, because he finally made sure his best friend was alive.
Why Sora’s Reactions to Kairi and Riku Are Different