A budding battle between U.S. cable and phone companies has brought fresh competition for services typically dominated by a few large companies.

Wireless carriers are using the excess capacity on next-generation networks to win over customers who have been using traditional broadband-internet providers, while those same cable companies are promoting new and cheaper cellphone plans.

The competition, in some instances, has created a refuge for consumers as inflation is driving up prices on just about everything else.

The consumer-price index—a measure of what people pay for goods and services—rose 8.5% in July from the same month a year earlier, down from 9.1% in June, which was the fastest pace of price increases since 1981. The cost of internet service rose by 1.7% in July from a year earlier, according to the Labor Department.

New fifth-generation cellular networks have helped carriers T-Mobile

TMUS -1.22%

US Inc. and Verizon Communications Inc.

VZ -0.56%

sign up 2.2 million wireless-internet customers through June, often at traditional broadband providers’ expense. The mobile-phone companies’ fixed wireless signals beam broadband connections from cell towers to routers placed in homes and businesses instead of by wire, which can be costly and time-consuming to install.

The wireless threat contributed to the cable industry’s worst quarter in years.

Comcast Corp.

CMCSA -2.74%

lost residential customers in the most recent quarter for the first time ever, a shift after many quarters of growth earlier in the pandemic. So did

Charter Communications Inc.

CHTR -3.51%, its first decline in nearly a decade.

Cable-internet providers blamed a slowdown in household moves for the drop but said new competition from mobile carriers played a role—albeit a small one.

Comcast Chief Executive Brian Roberts said he expects the flow of people moving to wireless-internet service to slow down, because mobile carriers face capacity constraints that limit the number of internet users they can add.

T-Mobile said a little more than half of the 560,000 broadband customers it added during the second quarter came from cable competitors.

“Demand continues to build from dissatisfied suburban cable customers to underserved customers in smaller markets and rural areas,” said T-Mobile CEO

Mike Sievert on an earnings conference call last month.

In Nashville, Tenn., Travis Murdock dropped his Xfinity cable service recently for T-Mobile’s home-internet offering, which became available in his area. The business analyst said he had grown tired of Comcast’s marketing calls and of negotiating a new price every year when the promotion he had been using expired.

The move took his bill down to $50 a month from $85. T-Mobile locked in the rate for as long as he keeps the service, he said.

The quoted internet speed is slightly slower with T-Mobile than his previous service, but he said he hasn’t noticed a difference.

It isn’t all bad for cable. The biggest cable companies have spent the past five years winning over customers for cellphone service who might have otherwise signed up for lines under traditional wireless brands. Comcast and Charter have amassed nearly nine million mobile-phone subscribers since Comcast launched its wireless service in 2017.

“The wireless industry appears to be heading towards yet another period of escalating competition,” said

Craig Moffett, analyst at research firm MoffettNathanson.

The ultimate winner may be wireless customers.

AT&T Inc. and Verizon have implemented some price increases this year, but Mr. Moffett said the companies have also introduced lower-cost plans to compete with offers from the cable providers.

On Monday, Comcast announced lower pricing for customers seeking two or three lines under its wireless plan offering unlimited data.

Jody Ewing said she switched her wireless plan to Charter’s Spectrum from Verizon last August, saving about $30 a month and upgrading to unlimited data for her and her husband’s phones in the process. The retiree from Santa Ana, Calif., was already paying for Spectrum internet and cable, and said she has never been happier with a carrier. Now, she can send as many photos as she wants to her children, though she said she still can’t get her husband, Kurt, to remember his phone when he leaves the house.

Cable companies aren’t using their own cellphone networks to connect their customers on the go—they are paying the wireless providers for access under reseller agreements—but their services are nevertheless boosting their bottom lines. Comcast and Charter rely on Verizon, while

Altice USA Inc. has a deal with T-Mobile.

Telecom analysts caution that there are limits to both industries’ encroachment on the others’ turf. Cable companies lack the cell towers and other infrastructure they would need to make a big dent in the business of the largest wireless companies. The top three U.S. wireless carriers together serve roughly 300 million cellphone users.

T-Mobile executives have said their 5G network is strong enough to cover 40 million homes and businesses with wireless broadband service. Of that number, the company plans to serve seven million to eight million locations by 2025. Comcast, the nation’s largest broadband provider, had 32.2 million total broadband customers at the end of June.

Cellphone carriers like T-Mobile, for their part, say the number of home-internet customers they can profitably add is limited. A single cell tower can only handle a certain volume of internet traffic at once, and home-broadband customers chew up 10 times as much data as a typical smartphone user. Analysts note that wireless customers are also more profitable and will likely stay the priority.

“You never want to crowd out or erode the quality of service you’re giving to your mobile guys,” said New Street Research analyst Jonathan Chaplin.

“That’s a much more valuable market to you.”