The various explanations of stealth are not quite worded well enough so some clarification is in order: you're no longer hiding from a creature if it can see you clearly. Having some cover is sufficient to remain hidden, so that example of blending into a crowd is totally appropriate with RAI.
You've got to have full cover (or suitable distraction by DM fiat,) in order to attempt to hide from a creature in the first place, so beating their passive perception is more about them having a good idea of what you did as soon as you broke line of sight. In the case of a chase I expect they would continue running until they rounded whatever corner or passed through some curtain-like piece of scenery that obscured you. If you're still appropriately hidden from them at that point their either assume you rounded some other corner and plow forward until you're able to sneak off in some other direction, or they slow down and try to figure out which way you went with active searching. If you're simply in the only barrel that exists then they probably grab you, but with some distance between you and them you'd have time to stop going where they expect you to be and maybe get yourself a whole path where you've got the cover to keep moving while they sit there taking the lids off of barrels, or trying to find a footprint or other hint at where the hell you just went. That barely matters though- so long as they aren't running at you to try and close the distance, you're gaining enough ground that it's safe to say you weren't caught during this chase.
If they were the only creature after you then things are pretty much over until fate conspires to introduce you to them again. If it's more like the entire town guard is after your neck them maybe you need to cover some more ground before you can relax.
You've got to have full cover (or suitable distraction by DM fiat,) in order to attempt to hide from a creature in the first place, so beating their passive perception is more about them having a good idea of what you did as soon as you broke line of sight. In the case of a chase I expect they would continue running until they rounded whatever corner or passed through some curtain-like piece of scenery that obscured you. If you're still appropriately hidden from them at that point their either assume you rounded some other corner and plow forward until you're able to sneak off in some other direction, or they slow down and try to figure out which way you went with active searching. If you're simply in the only barrel that exists then they probably grab you, but with some distance between you and them you'd have time to stop going where they expect you to be and maybe get yourself a whole path where you've got the cover to keep moving while they sit there taking the lids off of barrels, or trying to find a footprint or other hint at where the hell you just went. That barely matters though- so long as they aren't running at you to try and close the distance, you're gaining enough ground that it's safe to say you weren't caught during this chase.
If they were the only creature after you then things are pretty much over until fate conspires to introduce you to them again. If it's more like the entire town guard is after your neck them maybe you need to cover some more ground before you can relax.