Ask any good chef: Why do some recipes work, while others, with the very same ingredients, do not? Ah, but it’s the QUALITY of the ingredients that matters, that chef will say.

And so it is with Stephen Frears’ “Philomena,” a film whose cinematic recipe seems tricky at best: Take a shocking and tragic tale — a true one, involving the Catholic Church, no less — and make it into a film that’s part serious drama, part road-buddy movie .

Such an unwieldy mix flirts with danger, but “Philomena” works, thanks to the quality of its ingredients — especially the sensitive and nuanced performances by Judi Dench and by Steve Coogan, who co-wrote the script.

Director Frears, carefully calibrating the tone, is in fine form as he tackles a story based on the 2009 investigative book “The Lost Son of Philomena Lee,” by Martin Sixsmith. Lee, still living today, was an Irish teen who became pregnant during a fairground tryst. Rejected at home, she was sent to a convent where she endured a painful birth — and told the pain was penance for her sin — then forced to work in the laundry with other “fallen women” for years, allowed only one hour a day with her son.

Worse yet, the convent sold babies to wealthy Americans, and Philomena’s son, Anthony, was carried off one day as a toddler, without so much as a goodbye to his mother.

The movie begins on Anthony’s 50th birthday, with Philomena still desperate to find out what happened to him. Her adult daughter has a chance meeting with the former BBC journalist Sixsmith, who’s just lost his government job amid scandal, and is in need of work. At first, Sixsmith, rather an Oxford snob, dismisses the tale as a “human interest” story.

But soon, Martin and Philomena are heading to Washington, where they make one astonishing discovery after another. And they discover things about each other, too. Philomena, it turns out, is chatty, cheerful and fond of romance novels. Martin is rather abrupt and snooty, and wants his “quiet time.”

Will these opposites find common ground? Philomena, despite her devastating treatment by the Catholic Church, remains deeply religious and slow to blame the nuns who mistreated her. Martin is cynical about religion, and eager to achieve vindication for Philomena.

The film also explores questions of journalistic ethics. The pair’s trip to Washington is paid for by a tabloid interested in the lurid aspects of the tale. Martin is helping her, but is he exploiting her, too? We wouldn’t care about any of this if the performances were weak. But both actors find complexity and depth. Dench is not known for playing weak characters: M, from the Bond movies, various British queens, but she finds a way to imbue a simple, character with an inner strength and dignity.

And it’s a happy development that producers won their appeal to have it rated PG-13 rather than R.