They go away. The spell gives you a loan of 5 current HP and 5 max HP, and when the spell ends, you give 5 max HP and 5 current HP back.
(Maybe they intended you to keep the current HP like in other healing spells, but I'd be hard put to reason that the "for the duration" somehow makes the maximum HP temporary, but not the current HP too. We've also little indication this was a mistake, other than it's surprising. So, let's go by what they wrote.)
That can drop you to 0hp, but by the end of the 8 hours, you're probably resting and in a healthy state, and the loss of a portion of your HP won't be devastating.
The fact it can drop you to 0hp might be surprising, but it makes sense from the spell's description:
Your spell bolsters your allies with toughness and resolve.
The spell gives you a little bit of extra oomph to keep you going. (Well, eight hours of oomph.) When the spell goes away, that oomph does too. If you're decently healthy, you'll feel slightly more worn. If you're at 1-4hp, basically on the brink of passing out and dying, then this oomph is the little bit extra that's still keeping you going, and it will be bad if it goes away.
Have healing spells handy if you have someone under Aid, and keep track of time to make sure they're in a healthy state when it ends.
Of course, if you find the above absurd or terrible or something else, you can feel free to say the 5hp granted goes away first, just like temporary HP.
Isn't it Temporary HP?
Probably not. D&D 5e does have rules for Temporary Hit Points, but this spell doesn't appear to grant them. They could have written "temporary HP", but instead they wrote "current HP".
The argument could be made they should be interpreted as Temporary HP because they're temporary, but nothing in either Aid's description nor the writing about Temporary HP really suggests this interpretation should be made. Aid seems to grant real HP, which means it can do things Temporary HP can't do, like bring you back from 0hp.