Coal and natural gases are fossil fuels that are found in geologic formation. They both form under similar environment of high temperature and pressure which transforms organic matter.
Natural gas is a fluid and coal is a solid.
How did they form differently?
Natural and gas and petroleum are both derived from an organic matter rich in both plant and animal remains.
Coal is typically derived from organic matter that is rich in only plant remains usually formed in swampy area.
The one at the base would be much older due to the law of super position, and the rock at the top would be much newer,again, due to the law of super position.