Walgreens Boots Alliance Inc. and Rite Aid Corp. scrapped their $9.4 billion merger agreement, the latest in a series of high-profile deals to be derailed by antitrust enforcers.

Instead, Walgreens said it would seek to buy half of Rite Aid’s stores for $5.18 billion in cash. Executives said they had crafted the smaller deal to address regulatory issues, but antitrust experts said it doesn’t eliminate competition concerns.

The...