Austenitic Stainless Steel 316 contains 2.5% Mo while 304 does not. Depending on the environment in certain cases 316 may be more corrosion resistant than 304.
For welded application both materials should be of the low carbon type (316L, 304L)
If this is for a flue venting a combustion gas, and there is ever any risk of condensation forming, then neither would be acceptable.
There are standards for flues, as they are critical saftey items. A limited number of high alloyed products are allowed.
The role of the Mo in the 316 is to increase the stability of the surface passive layer improving the resistance to pitting intitation.
= = = = = = = = = = = = = = = = = = = =
Corrosion never sleeps, but it can be managed.