Charles Grodin, a versatile actor with a talent for wry humor and deadpan comedy who appeared on Broadway, starred in such films as “The Heartbreak Kid,” “Midnight Run” and the “Beethoven” comedies and was known for his cheeky appearances on TV talk shows, including his own, died May 18 at his home in Wilton, Conn. He was 86.

The cause was bone marrow cancer, said his son, Nicholas Grodin.

Mr. Grodin made his mark in both comedy and drama, onstage and on screen and as a writer and director. He often adopted a quirky style that could be simultaneously self-effacing and self-important. He was a master of the cringeworthy moment, when it wasn’t clear if he was being funny, naive or insulting — or a little of all three.

After appearing on television and stage early in his career, he made his film breakthrough in 1972 in “The Heartbreak Kid,” based on a story by Bruce Jay Friedman. In the film, which was directed by Elaine May with a screenplay by Neil Simon, Mr. Grodin played a cad who, while on his honeymoon, falls in love with another woman, played by Cybill Shepherd.

“Now there is a slight complication,” he tells the girlfriend’s parents in an awkward meeting over dinner. “I happen to be a newlywed.”

He earnestly asks her father, played by Eddie Albert, “I would like to know, in all candor, how you feel about what I’ve said and to ask if I have your approval.”

“Not if they tied me to a horse,” Albert says, “and pulled me 40 miles by my tongue.”

“Well, that’s an honest answer, sir,” Mr. Grodin’s character replies.

In 1975, he appeared on Broadway opposite Ellen Burstyn in Bernard Slade’s hit play “Same Time, Next Year.” The romantic comedy is about a man and woman — married to other people — who have met for an annual romantic rendezvous for more than 20 years. New York Times critic Clive Barnes praised Mr. Grodin’s portrayal as “a monument to male insecurity, gorgeously inept.” Burstyn won a Tony Award as best actress.

He was passed over for Alan Alda in a 1978 film version of the play. Mr. Grodin played a scheming lawyer in Warren Beatty’s “Heaven Can Wait” (1978), the same year he won an Emmy Award — not for acting but as one of several writers of a TV special about singer-songwriter Paul Simon.

Mr. Grodin had one of his most memorable roles a decade later, playing opposite Robert De Niro in 1988’s “Midnight Run.” In the film, De Niro plays a bounty hunter (Jack Walsh) who has tracked Mr. Grodin (Jonathan Mardukas), who plays an accountant who has skipped bail after embezzling $15 million from the mob. In a comic thriller that came to be considered one of the decade’s best buddy movies, the pair travel across the country — often handcuffed together — while being pursued by mobsters, FBI agents and their own anxieties.

An oddball friendship, or at least a foxhole sense of camaraderie, develops between the two, with Mr. Grodin’s character veering from abject fear — “I have aviophobia,” or fear of flying — into moments of quiet absurdity.

“You ever had lyonnaise potatoes?” Mr. Grodin says as Mardukas. “They are these types of potatoes that are sautéed but then they have this onion thing added to them, and they are really, really delicious. They work well with any, uh, chicken or pork dish. You know I could set you up with lyonnaise potatoes for the rest of your life.”

De Niro as Walsh: “Why don’t you just shut . . . up!”

“De Niro is often said to be the best movie actor of his generation,” Roger Ebert wrote about “Midnight Run.” “Grodin has been in the movies just about as long, has appeared in more different titles, and is of more or less the same generation, but has never received the recognition he deserves — maybe because he often plays a quiet, self-effacing everyman. In ‘Midnight Run,’ where he is literally handcuffed to De Niro at times, he is every bit the master’s equal, and in the crucial final scene it is Grodin who finds the emotional truth that defines their relationship.”

Mr. Grodin later starred in “Beethoven” (1992) and “Beethoven’s 2nd” (1993), popular family comedies featuring a lovable Saint Bernard.

In 1994, he abandoned Hollywood for more than decade, preferring to stay with his family in Connecticut. Over the years, Mr. Grodin had been a frequent and sometimes caustic guest on Johnny Carson’s and David Letterman’s late-night talk shows. He often presented himself as a surly, aggrieved guest, asking embarrassing questions of his hosts and sometimes bemoaning his fate as an underappreciated actor.

“I invented a persona of somebody who was always unhappy about something,” Mr. Grodin told the Los Angeles Times in 2004. “It was a joke. Carson and Letterman knew it was a joke, but I don’t think the audience did.”

In 1995, Mr. Grodin brought that same grumpy personality to his prime-time CNBC talk show, where he dominated the discussions and repeatedly said, “Can I have the camera, please?”

Once, when interviewing best-selling writer Jackie Collins, known for her racy novels about glamorous people, he interrupted her when she said of her characters, “It’s what’s in the mind that counts.”

“Right, Jackie, right. I appreciate your forthrightness and honesty,” Mr. Grodin said. Then he turned to the camera and said to the audience: “We’ll get Jackie to tell the truth before the night is over.”

Charles Sidney Grodin was born April 21, 1935, in Pittsburgh. His mother was a homemaker, and his father sold buttons, zippers and other supplies to tailors.

“I come from more of a street background than Robert De Niro does,” Mr. Grodin once said.

He said he was drawn to acting after seeing the 1951 film “A Place in the Sun,” with Elizabeth Taylor and Montgomery Clift. Mr. Grodin briefly attended the University of Miami, then returned to Pittsburgh to study acting and appear in summer stock theater. After moving to New York in the 1950s, he studied acting with Uta Hagen and Lee Strasberg while working as a cabdriver, night watchman and postal clerk.

After several television and off-Broadway credits, he first appeared on Broadway in 1962 in “Tchin-Tchin” and later directed and acted in other Broadway plays. He was up for Dustin Hoffman’s role in “The Graduate” but turned it down, he said, because the salary was too low.

Mr. Grodin had small parts in “Rosemary’s Baby” (1968) and “Catch-22” (1970) before “The Heartbreak Kid” showcased his dry, sometimes bumbling comic style. His other films included a 1976 remake of “King Kong,” Steve Martin’s “The Lonely Guy” (1984) and the 1993 political comedy “Dave,” with Kevin Kline and Sigourney Weaver.

Mr. Grodin’s talk show was canceled in 1998, but he kept busy with various projects. He was a playwright and the author of seven books of memoirs and humorous essays. He delivered commentary on “60 Minutes II” and, for about 10 years, had a column in the New York Daily News. He received awards from Habitat for Humanity and other organizations for his work on behalf of homeless people.

His marriage to Julie Ferguson ended in divorce. Survivors include his wife since 1983, Elissa Durwood; a daughter from his first marriage, Marion Grodin; a son from his second marriage, Nicholas Grodin; and a granddaughter.

Mr. Grodin revived his acting career in his 70s and 80s with roles on the TV comedy “Louie” and in a 2016 miniseries, “Madoff,” playing Carl Shapiro, who lost more than $500 million to swindler Bernie Madoff.

He sometimes wondered if his best performances might have been his comic turns as an angry guest on talk shows. When he learned that Bette Midler had won an Emmy Award for best appearance on a talk show, Mr. Grodin said he felt left behind again.

“I didn’t know you could get nominated as a guest,” he said. “I could have been nominated as best actor on a talk show — that might have been my category.”

Correction: An earlier version of this story incorrectly stated that “The Heartbreak Kid” was based on a novel by Bruce Jay Friedman. It was based on a short story by Friedman.

Harrison Smith contributed to this report.