This isn’t usually as fun or pleasant a sensation as it is on Earth though! The lack of gravity in space makes the contents of an astronaut’s belly float near a valve at the top of their stomach. This valve does not close completely, as it typically relies on Earth’s gravity to keep all the digesting food down below where it belongs. This means that in zero gravity any time an astronaut burps, they run the risk of releasing some of these food particles in a “wet” burp! Gross!! Thanks for that useful tip, NASA.
Not sure what happens when you fart in space, but it’s probably not at all like RocketMan.