The flange is securely attached to the waste pipe. If there is any gap, it is installed wrong. If it is pvc, it is normally solvent welded. If it is cast iron, it is usually a poured lead/oakum joint. Both of these are water and gas tight...I don't understand your question. The flange is not a funnel to direct the waste into the pipe just sitting there, it is an integral part of the path.