“Don’t let the door hit you on the way out!”

This is an abrupt way to tell someone to leave. The sarcastic advice only applies if the person is leaving, so even if they wanted to stay, you are already speaking as if they are leaving. You can also say this if someone is already leaving, to show that you don’t care if they leave (for example, if they storm out in the middle of an argument).

「出るとき扉にぶつからないように気を付けな!」

これは「出ていけ」という意味のフレーズです。皮肉なアドバイスは、(扉を通って)出る場合しか適切ではありませんので、残るつもりだったとしても、出ていく前提でしゃべっています。すでに出ていくつもりの人にも、自分には相手が出ていってもどうでもいいことを示すために使えます(例えば口喧嘩の途中で怒って出ていく人に)。