She wrote it for the film "Four Good Days," which stars Glenn Close as a mother who struggles to save her daughter (played by Mila Kunis) from a life-threatening heroin addiction.
"It's a pretty harrowing and powerful story. And while this story ends well, a lot of stories, sadly, in this country and elsewhere, don't end so well," she said.
See her full interview with On The Red Carpet in the video player above.
Warren referred to the American opioid crisis as another pandemic and said she wrote "Somehow You Do" as a source of hope for people and families battling addictions.
Over time, however, she came to realize that the song also resonated with others who found themselves struggling with hardships during the COVID-19 pandemic.
"I saw the movie, and it was at the beginning of the pandemic. The song really seems to have gotten people through a lot," Warren said. "I mean, everybody wants to be seen, everybody wants to be heard. Everybody wants to know that they're being listened to and that they're not alone."
In her songwriting, Warren said she hopes that her words can serve as a source of comfort and encouragement for all.
"The song is written for the movie and fits the movie, but ... I don't say what you're going through in the song, so you can make it about whatever you're going through," she said.
WATCH | Diane Warren says songwriting is like being an Olympian, you always have to practice
FULL LIST: 2022 Oscar nominations
Mark your calendar: March 27 is Oscar Sunday. Special "On The Red Carpet" coverage begins at 1 p.m. ET 10 a.m. PT and continues all day leading up to the 94th Academy Awards ceremony. After the last award is handed out, stay with "On The Red Carpet" for continuing coverage. Be sure to follow @OnTheRedCarpet on Facebook, Twitter, Instagram and TikTok for all your Oscar news and information. Click here to download our CTV apps to watch "On The Red Carpet" wherever you stream.