If you find that the blistering, unrelenting heat is making you anxious and irritable, even depressed, it’s not all in your head. Soaring temperatures can damage not just the body but also the mind.

As heat waves become more intense, more frequent and longer, it has become increasingly important to address the impact on mental health, scientists say.

“It’s really only been over the past five years that there’s been a real recognition of the impact,” said Dr. Joshua Wortzel, chair of the American Psychiatric Association’s committee on climate change and mental health, which was set up just two years ago.

“Our understanding of the basic biology of why this association exists is still in its infancy,” he added.

High temperatures are strongly associated with an increase in suicides, researchers have found. Heat has been linked to a rise in violent crime and aggression, emergency room visits and hospitalizations for mental disorders, and deaths — especially among people with schizophrenia, dementia, psychosis and substance use.

For every 1 degree Celsius (or 1.8 degrees Fahrenheit) increase in temperature, scientists have estimated that there is a nearly 5 percent increase in the risk of death among patients with psychosis, dementia or substance use.

Researchers have reported a 0.7 percent increase in suicides linked to rising temperatures, and about a 4 percent to 6 percent increase in interpersonal violence, including homicides.

Heat not only fuels feelings like irritability and anger, but also seems to exacerbate mental illnesses, such as anxiety, schizophrenia and depression. Older adults, adolescents and people with pre-existing mental illnesses are particularly vulnerable, as are people who do not have housing or are of lower socioeconomic status.

A landmark study last year analyzed data on more than two million people with private insurance and found that emergency department visits for mental illnesses were significantly higher during the five or six hottest days of summer, compared with the coolest days of the same season.

The increase was greater in northern parts of the United States, perhaps because these areas are less prepared to cope with heat waves than places like the Southwest, said Amruta Nori-Sarma, an environmental epidemiologist at Boston University School of Public Health, who led the study.

The gap was evident across a range of mental health conditions, including mood and anxiety disorders, stress disorders, schizophrenia, substance use disorders and self-harm. “Extreme heat is an external stressor that seems to be exacerbating people’s mental health symptoms,” Dr. Nori-Sarma said.

The effect is likely to be even more pronounced among people with limited or no insurance coverage or who are experiencing homelessness, she added.

Scientists have proposed various biological explanations for the connection between soaring temperatures and mental health disorders. At least some of these illnesses may have a simple origin: disrupted sleep.

Room temperature needs to dip below 68 degrees for a comfortable rest. On warmer nights, people fall asleep later and wake up earlier, and the quality of their sleep is poorer.

Days or weeks of sleeping in overly warm rooms can not only exacerbate chronic conditions like diabetes and heart disease, but also negatively affect psychiatric disorders, suicide risk, memory, mood and cognitive function.

Older adults and women are more likely to be affected: One study found that sleep loss among older adults is about twice as high as among younger people.

Some mental health problems may be an extension of physical issues. On a recent afternoon, Dr. Asim Shah, a psychiatrist at Baylor College of Medicine in Houston, found that nearly every patient’s pulse or heart rate was higher than it had been three months earlier.

“That increase in your heart rate can increase your anxiety,” Dr. Shah said. “So heat causes a lot of physical changes, which leads to a lot of emotional and mental changes.”

Serotonin, a neurotransmitter linked to mood, anxiety and depression, also regulates the body’s ability to sense temperature. Increased sunlight and heat can raise serotonin levels and may lead to mood swings, aggression and irritability. A range of widely used drugs — including antibiotics, beta blockers, some antidepressants and antihistamines — also affect the body’s ability to sense and regulate body temperature.

Medications prescribed for schizophrenia, depression and bipolar disorder, including widely used lithium, impair the body’s ability to sweat and cool itself. Extreme heat and sweating can concentrate levels of lithium in the body to toxic levels, and can lead to serious physical and mental problems and even death, Dr. Shah said.

“We need to prepare our patients who take these medicines, which interact with sunlight,” he added. “Physicians also need to be more aware.”

Other drugs suppress thirst and can result in dangerous levels of dehydration. Alcohol, caffeine and some medications that increase urine output can also lead to dehydration, mental problems and confusion.

And there are indirect routes through which high temperatures can affect mental health, according to Dr. Wortzel. In hot weather, some crops absorb less zinc, iron and other micronutrients. Deficiencies of those nutrients can have psychiatric consequences, including neurodevelopmental disorders.

Rising temperatures are expanding the reach of disease vectors, like ticks, that carry pathogens that may cause psychiatric and neurological symptoms. Heat also increases allergens and pollutants, and worsens air quality, which alone can trigger anxiety and depression.

Heat is only one aspect of climate change, and its immediate effect on mental health can be difficult to extricate from emotions regarding the larger existential threat.

Last year, the Intergovernmental Panel on Climate Change warned that rising temperatures, displacement, famine and economic and social losses would lead to deep anxiety, grief and stress. Children, adolescents, older adults and those with chronic health problems are particularly vulnerable, the report cautioned.

“The heat has very profound effects,” said Dr. Robert Bright, a psychiatrist at Mayo Clinic. This summer, Phoenix, where Dr. Bright is based, experienced temperatures above 110 degrees Fahrenheit for a record 31 consecutive days.

“People get very overwhelmed and worried about this,” he added.

Scientists have coined the term “climate distress” to describe a multitude of feelings triggered by the environmental changes appearing around us: anxiety, terror, sadness, shame, guilt. Those who already have anxiety or are depressed may have an even more difficult time coping.

“It is unfortunately true that this may be the coolest summer for the rest of our lives, which is unsettling to reckon with,” said Britt Wray, the director of Stanford University’s program on climate change and mental health.

People often turn to cognitive behavioral therapy, medications or other strategies to cope with difficult emotions. But “when it comes to the climate crisis, those interventions fall apart, because the threat is real,” not just a matter of perception, she said.

Local governments can help people feel less vulnerable and more empowered by planning for long stretches of hot days. Officials can provide information about the nearest cooling rooms for people without air-conditioning at home.

Dr. Wray said connecting to others with similar worries and taking action at various levels to forestall the worst outcomes can also help alleviate climate distress.

“People in Phoenix, Ariz., have died just from falling on the pavement and getting third degree burns,” she noted. “That’s the kind of thing that nightmares are made of.”