DoorDash said on Tuesday it has agreed to buy its U.K. rival Deliveroo for about £2.9 billion (around $3.85 billion).