Questions about ESP32

Hi, I want to ask a question- Does the ESP32 connect to another ESP32? And if both can be connected do they have to be on the same wifi? If one ESP32 is about 400 km away, will both of them still send/receive data? If I handover one ESP32 with the code to a guy who lives far away and will both of them work and receive data?? Is there any option to insert a new wifi network without having to reprogram?

Thanks in advance!!!

Yeah that's also possible and in order to do that, you have to create a webserver (static IP Address) i.e. you can buy some domain www.abc.com and then upload your data to that webserver from both ESP32 modules. You can add as many as you want and can place them anywhere in the world with internet access.