The Massachusetts Senate unanimously passed a bill to ban the use of hand-held devices while driving, proclaiming the measure would reduce the number of deaths on the road.

“After fifteen years of filing and tirelessly pushing legislation to ban such dangerous behavior, Beacon Hill is finally ready to end the tragedies occurring on our roadways,” said Senator Mark Montigny, a New Bedford Democrat who sponsored the bill. “Today, the Senate again passed a strong bill to save lives.”

Massachusetts banned texting while driving in 2010. But the hands-free-driving bill would ban the use of all hand-held devices by drivers, except when the device requires a “single tap or swipe” to switch to hands-free mode.

The key holdup has been over concerns the legislation would increase racial profiling by police. Some lawmakers said such a law could increase the number of traffic stops of black and Hispanic drivers.

The Senate bill would require police to record the “perceived race and ethnicity” of each driver who is stopped. The House bill would require officers to record the data only when a warning or citation is issued.

The Senate’s approval comes more than three weeks after the House overwhelmingly passed its own version of the legislation. The chambers will now form a conference committee to work out their differences.

Governor Charlie Baker has indicated he supports the effort.

In a floor speech, Senator Cynthia Stone Creem said “the point of this is to make sure that stops are not being done in a discriminatory way.”

“I believe this bill strikes the right balance between safety and individual rights,” the Newton Democrat said.

During debate, several senators recounted stories from families who had lost loved ones because of crashes involviing hand-held devices.

If the bill is signed into law, Massachusetts would join 18 other states that have passed hands-free-driving legislation, including New Hampshire, Vermont, and Rhode Island.