ESP32 UART to Raspberry Pi I2C
simulate this circuit &ndash; Schematic created using CircuitLab
The ESP32 has more than 1 UART. Although it is common to only use one of them in the default configuration, the ESP32 has 3 UARTs. You can configure which GPIO pins to use by using the uart_set_pin() function. You should check the datasheet or the Espressif website for the details.
Using multiple UARTs allows the ESP to act as a Serial Bridge. This function is frequently implemented with the different flavors of ESPs as a WiFi Serial Bridge, but it works for wired connections as well.
UART Page