The Allentown City Council member will face Republican Robert E. Smith Jr. in November’s general election.
Mackenzie, who has served in the House since 2012, is all but assured another 2-year term.
The bill now goes to the Senate. If approved, Gov. Tom Wolf has said he will veto it.
The measure passed the House education committee along party lines, with Republicans in support.
A House committee approved legislation that allows more gas drilling and urges new pipelines.