Non are in the exact same business but there are significant overlaps.
Amazon makes it's profit from AWS, which is in the same business (and beating) Google Cloud and Microsoft Azure.
Putting Amazon and Apple in the same business is a bit more of a stretch. Amazon sells things (and is nowadays mostly a middle man for third parties selling things through Amazon warehouses and delivery), Apple designs (and has them manufactured by third parties) things from CPUs all up the value chain to devices and it's software. The overlap is partially in services, but of which aren't particularly strong right now (Amazon Prime Movies/Series vs Apple TV+). There's not really a competition on devices anymore (Fire Phone/tablets vs iPhone/iPad).