Kids/YA Scifi story about a boy in an alien zoo/human habitat who befriends a man with candy in his pocket
I posted this in r/tipofmytongue yesterday but haven't been able to figure it out yet, so I'm hoping one of you amazing book detectives can help me.
The main character is a kid (I'm pretty sure a boy) who is in an alien zoo. Idk if he was abducted for the purpose of being in the zoo, or maybe rescued from some disaster and being kept in a space habitat or something? The aliens treat the humans well, but he's still sad. He has parents (and I think a sibling maybe?) but I think he's separated from them.
The other human in the story is an older man who has no family, but does have a dog. The main thing I remember is that the man keeps candy in his pockets for some reason and that's significant to the kid. I think the man gives the kid candy sometimes but it's always kind of melted?
I think the kid gets back home eventually, and then at some point he has some different kind of candy that doesn't melt when you keep it in your pocket and it makes him think of the older man at the alien zoo.
I'm pretty sure this was either a kids' chapter book or a YA novel. It might have been a short story.
I read it sometime in the 1990s, my best guess is between 1994-6. I know that when I read Slaughterhouse Five in high school c. 2000 it vaguely reminded me of this story. It's possible it wasn't written for kids, but I don't remember anything mature or salacious.