You can’t use the sketch as is with an Uno as you only have 1 serial port, unlike Mega or Leonardo that has several.
Alter the following part to look like this:
// Hardware Serial on Mega, Leonardo, Micro... //#define EspSerial Serial // or Software Serial on Uno, Nano... #include <SoftwareSerial.h> SoftwareSerial EspSerial(2, 3); // RX, TX
Connect ESP-01 rx to pin 3 (TX) on Uno and ESP-01 tx to pin 2 (RX). If it doesn’t work try swapping the pins around.
BUT your Uno is a 5V device whereas the ESP-01 is a 3.3V device so you need to ensure you drop the voltage from the Uno TX to the ESP BEFORE you do anymore testing if you haven’t already done so.