Not a direct replacement, but if you need WiFi connectivity then programming an ESP with some port extenders is usually much easier than figuring out the communication between Arduino and ESP module - especially as you normally have to use a Serial connection between the two.
Using AT commands to control an ESP8266 over a serial connection is straightforward if you just want to add some WiFi capability to an Arduino. And much cheaper than a WiFi shield.
A 5v Arduino will be able to detect the 3.3v serial signal from an ESP8266 on the Arduino Rx pin but you will need to step-down the 5v Arduino Tx signal before it gets to the ESP8266 Rx pin. There are various ways to do that. You can use a couple of resistors as a voltage divider
OR you can connect the ESP8266 pin to 3,3v with a resistor (5k6 should do) and connect the Rx pin to the Arduino Tx pin with a diode that prevents the 5v from getting to the ESP8266. In effect the resistor holds the ESP8266 Rx pin HIGH and the Arduino can pull it LOW.
You can do it either way and there is lots of documentation for both ways.
The Arduino UNO/NANO can talk to the ESP and you can use the ESP as a WiFi node
You can use the ESP8266 as the microcontroller with built in Wifi if your needs allow.
There is no wrong way.
I am a firm believer in starting with the application and then picking the right parts to make it easy to get it done.
Since all you asked was if it can be done, then yes, and Google is your friend. tons of links to walk you through it.
And, as was pointed out, the ESP8266 has quite a few pins that might allow you to use that instead of an UNO/NANO