New York (CNN Business) This is the golden age of food delivery.

Years ago, most people who wanted food to arrive at their door were limited to pizza. But delivery platforms like DoorDash, Uber Eats, Postmates andhave opened the floodgates: Now, people can order breakfast from Panera , coffee from Starbucks, a burrito from Chipotle , a burger from McDonald's among countless other options.

Delivery represents a big business opportunity for restaurants. Customer visits to restaurants have been about flat over the past five years through May, but delivery has grown 17% in the same time frame, according to David Portalatin, national food and beverage analyst for NPD Group.

And delivery has plenty of room to grow. It accounts for only 3% of all American restaurant orders, Portalatin said.

The shift to delivery is "profound," said Noah Glass, founder and CEO of Olo, a business-facing food ordering platform that works with restaurant chains and delivery aggregators like Uber Eats. "It's happening incredibly quickly and the stakes are incredibly high."

Domino's DPZ Partnering with delivery platforms can give restaurants access to a whole new set of customers. But some, like, think it's a bad idea.

Third-party platform commissions could hurt restaurants by eating into their profits and eroding customer loyalty. By partnering with them, restaurants could ultimately be hurting themselves.

Restaurants have to pay a commission when they partner with delivery aggregators.

Going all in

To cash in on the growing trend, restaurants are making big bets on delivery.

Starbucks SBUX McDonald's MCD Pizza Hut plans to close 500 restaurants in the United States to "accelerate the transition" to locations better suited for delivery and takeout, outgoing CEO Greg Creed said during a recent earnings call with analysts.announced this summer that it is expanding its partnership with Uber Eats nationally. Many big chains, like, are partnering with several delivery aggregators to reach customers loyal to each one.

Some are only offering flashy promotions through third-party delivery services.

Wendy's WEN Burger King offered a limited-time "taste test" when it launched the meatless Impossible Whopper nationwide . The promotion, which let customers order both the regular and Impossible Whopper for $7, was only available through DoorDash., similarly, celebrated receiving two million likes on a tweet by giving away spicy chicken nuggets via DoorDash.

By overhauling their operations to accommodate delivery and directing customers toward third-party platforms, restaurants are hoping to reach new customers who are loyal to those services. Most restaurants are also offering delivery through their own sites and apps, as well as partnering with multiple platforms.

Chipotle CMG , which has added a second assembly line designated for delivery and takeout orders, says its partnerships are boosting sales.

"Delivery remains a key driver of our digital growth," CEO Brian Niccol said during a recent earnings call."We have seen very little guest overlap between our own in-app delivery and our third-party delivery partner apps," he added.

Starbucks SBUX But some companies, like, are not yet capitalizing as much as they had hoped with delivery.

"It is still early days for food and beverage delivery in the US," CEO Kevin Johnson said during a recent earnings call with analysts. "While we are not yet seeing Starbucks Delivers meaningfully contribute to our US business results, we believe that delivery is an important long-term growth opportunity."

Not every restaurant chain thinks delivery partnerships are the way to go. Domino's, notably, has decided not to work with delivery sites.

Domino's doesn't partner with third-party delivery proviers.

The holdout

For Domino's, delivery is a big deal.

Not only has the company been delivering for years, but it uses the service to tout its tech capabilities: It's been testing self-driving delivery cars , has looked into delivery by drone and is now exploring using e-bikes to skirt traffic.

The pizza chain's sales have been suffering recently in part because of "aggressive activity from third-party delivery aggregators," said CEO Richard Allison during a call with analysts discussing second-quarter earnings.

He added that Domino's continues "to see a significant amount of pressure" from those services, and that he does "not expect this activity to ease in the near term."

Despite the pressure, Domino's is not planning to partner with a delivery site.

Allison said that he doesn't think partnering with third-party platforms creates incremental sales, and that those platforms will end up hurting restaurant profits.

The question of whether third-party platforms drive new sales or just redirect customers is key.

What could go wrong

Incremental sales are good for restaurants. But if customers who would order from, for example, the McDonald's app go through a partner like Uber Eats instead, McDonald's earns less profit, because it has to pay Uber Eats a commission.

It could also lose those customers to competitors.

Someone using a restaurant's app can only order from that restaurant. When they visit a delivery aggregator, they can sort by distance, delivery time, cost or cuisine, and end up ordering from a difference place based on those metrics.

"It's become clear to restaurant brands that they need to work really hard to get their loyal customers to order direct from the brand," said Glass.

And if something goes wrong with the order, customers are more likely to blame the restaurant than the delivery service. By outsourcing delivery, food companies are essentially outsourcing their brand management, as well.

Still, restaurant brands shouldn't avoid working with delivery services altogether, said Morningstar analyst R.J. Hottovy.

"I think at this point there's enough demand from consumers that you have to do it," he said.

But "you have to be smart about who controls that data," Hottovy said. "That's the biggest thing."

Ultimately, Hottovy predicts that restaurants will come up with a "hybrid" approach, relying on outside delivery services during off-peak hours and using their own drivers otherwise.