If you text and drive, it could cost you.

Arity, a unit of insurance giant Allstate, is tracking in-car smartphone use so that insurance companies can either punish or reward drivers, depending on how they use their phone while driving.

The technology works by using the smartphone's accelerometer and gyroscope to sense whether the device is being moved -- likely in a driver's hand -- or lying flat on a surface. Arity can also tell whether the phone is unlocked and apps are being used.

Allstate (ALL) may soon use the technology to determine consumers' car insurance rates. In a statement, it described the technology as a way to promote safe driving.

Arity analyzed data from 160 million trips by hundreds of thousands of Allstate drivers. What it found confirmed research showing that drivers on their phones are more dangerous.

Arity then went a step farther and used Allstate claims data to see how expensive distracted driving is. It says it found that the most distracted drivers cost insurance companies 160% more than the least distracted drivers.

Drivers using smartphones are more likely to get into accidents, and these crashes tend to be more severe. Paying out claims for these crashes racks up big costs for insurance companies.

Related: Smartphones may be to blame for spike in pedestrian deaths

"We believe that people are coachable and that by driving less aggressively, using the phone less, there are opportunities to not only give a more accurate insurance price based on choices, but to give drivers more control," Arity CEO Gary Hallgren told CNN Tech.

He sees the company's new smartphone-tracking method as more accurate than basing a person's prices off their credit score, a common industry practice.

Hallgren expects smartphone data to become commonly used by car insurers in the coming years. Insurance companies who don't use this data risk losing their best drivers to other companies that offer discounts related to rates of distracted driving, Hallgren said.

But before this becomes a reality, Arity will need regulatory approval from state insurance offices. And car insurance companies such as Allstate won't be able to use the technology without drivers agreeing to it. Arity requires drivers to download an app so that it can track how a phone is being used while driving.

Related: Can tech prevent texting and driving?

For concerned drivers, there are ways to minimize the likelihood that Arity will think you're distracted.

Katie DeGraaf, Arity's director of product, advises drivers to put their phones in airplane mode while behind the wheel.

If a navigation app must be used, she suggests setting it before departing, and not touching it during the trip. Arity's software is less likely to identify a driver as distracted if the phone is mounted in a cradle, instead of being held in a driver's hand.