ESP32 vs ESP8266: which one to pick?

Both have Wi-Fi. Here is when the extra power of the ESP32 is worth it.

The ESP8266 is a low-cost single-core Wi-Fi chip, perfect for simple sensors and switches. The ESP32 adds a second core, Bluetooth, more GPIO, more analog inputs and capacitive touch pins, and is the better default for new projects.

Both are 3.3 V devices - do not feed their GPIO pins 5 V signals directly. Both can be programmed from the Arduino IDE after installing the matching board package.

Pick the ESP8266 for the cheapest possible Wi-Fi node. Pick the ESP32 when you need Bluetooth, many pins, a camera board or more processing headroom.