When Nancy Lublin started Crisis Text Line in 2013, she thought of her New York City nonprofit as a tech start-up — and not simply because they text to counsel people in distress. Ms. Lublin wanted to use analytics to be smarter at it.

“I’d consider myself a tech C.E.O.,” she said. “The first thing I ask is, ‘What does the data say?’”

Five years after the site began, 4,000 volunteer counselors across the country — the site is always recruiting more — can work on their computers wherever there is internet. The nonprofit said it handled nearly a million chats last year, mostly with people under 25 who would rather text than talk about their problems.

The platform the volunteers log into is honed with a machine learning algorithm, which has analyzed past chats for actionable information. For example, the system automatically moves distressed people who write words like “gun,” “military,” “fentanyl,” or a crying emoji to the front of the line, colored orange. Data shows those are the most likely indicators that the person will need an active rescue from 911, and counselors start chats with them first, responding within an average of 38 seconds.

The chats are also creating a trove of information on distress nationwide. The highest per capita texts come from Montana; Midwesterners report the most bullying; the coasts are the most stressed; and people in the South most often mention L.G.B.T.Q. issues. (You can track the state-level data in real time at crisistrends.org.) The organization’s tech team is currently working on software to make the counselors even faster: For example, suggesting they answer with “you’re strong” to people who say they are overwhelmed.

The data also helps people on the ground who are fighting crises. In 2016, Ohio started a state-specific keyword with the Crisis Text Line — 4HOPE — and advertised it in schools. The nonprofit’s data crunchers noticed that use of the keyword fell in the summer. Their Ohio partners were alerted and placed advertising in movie theaters. The texts surged once more.