As previous answers, output power, Line of Sight and receiver sensitivity do matter. Also the antenna gain. As WI-Fi uses unlicensed 2.4GHz band, there are power restrictions in most of the regions. Typical maximum 1W (30dBm) of actual power and 4W (36dBm) of EIRP which includes antenna gain. That means if 30dBm actual power is used maximum antenna gain must be 6dBm, where as if 26dBm power is used maximum antenna gain could be 10dBm.
Consider you have a highly directional 24dBi outdoor Wi-Fi grid antenna, then your actual power could be maximum of 12dBm, so the maximum power would be 36dBm. That limits the combination of high gain antenna and actual power.
Point to point microwave communication does not come under these regulations. They use much higher actual power coupled with a highly directional antenna.
One extreme use cases is S band satellite communication. S band is between 2GHz to 4GHz and it is used to communicate with Geostationary Satellites at 36000km away.
Where as