like the nearby anus, is somewhat more formal than the alternatives, which are pretty informal or vulgar.
It is the concept itself, traveling through the alimentary canal and exiting from the waste area that probably invoked the reaction of your friend.
The word itself, 'rectum' is fine (like 'penis', 'vagina', etc), it's the situation that may be objectionable.
To clarify, there are words (expressions) and there are concepts (mental ideas) and words can be used to talk about concepts. Both can be distasteful or pleasant or somewhere in between. But they don't necessarily match.
A euphemism is a pleasant word for an unpleasant subject (these are fairly common, like the clinical anatomical words for potty talk). There are also dysphemisms which are rude words for more pleasant concepts (derogatory terms for ethnicities fall here).
It seems strange that there is such a disconnect, and often enough a euphemism will eventually become more and more a taboo expression, colored by the taboo concept (witness 'commode' or 'toilet').
Of course, anything related to poop is going to elicit a special reaction in the 10 year old in all of us, however euphemized the words might be.
To answer what you want directly, basically to 'spin' the wording so it all sounds ..um... palatable, instead of a euphemistic synonym, you'll probably want to say something slightly oblique like:
...and came out the other end.