WASHINGTON — The House, taking aim at youth vaping and tobacco use, voted Friday to ban the sale of flavored cigarettes and e-cigarette liquids, even as civil rights advocates and some African-American Democrats raised concerns that the legislation unfairly targeted black people.

The bill is aimed at curbing what public health experts see as an epidemic of youth vaping by banning online sales of e-cigarettes, as well as liquid flavors like mint, mango, cotton candy and bubble gum. But it also bans flavors in regular cigarettes, including menthol, which is popular among African-Americans, giving rise to fears that a prohibition could lead to over-policing in black communities.

“Those are legitimate questions to ask,” Speaker Nancy Pelosi conceded after the vote. But she said the measure was necessary to stop the tobacco industry from targeting a new generation, adding that it passed because of lawmakers’ overriding concerns about “the well-being of the children and stopping the path to addiction.”

The bill goes further than a partial ban announced by President Trump last month, which would forbid the sale of most flavored e-cigarette cartridges, but exempt menthol and other tobacco flavors. Its fate is unclear in the Senate, where Senator Mitch McConnell, the majority leader who represents the tobacco-producing state of Kentucky, has not given any indication that he would bring it up for a vote.