Using ESP32 but sensor operating on 5V (external ps)

So here is an example code

void setup() {
  Serial.begin(9600); //Baud rate: 9600
}
void loop() {
  int sensorValue = analogRead(A0);// read the input on analog pin 0:
  float voltage = sensorValue * (5.0 / 1024.0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  Serial.println(voltage); // print out the value you read:
  delay(500);
}

The sensor is operating on 5V, it is powered by an external power supply. But, I am using an ESP32. My question is can I use the code as it is or should I use (3.3 / 4096) instead of (5.0 / 1024.0)?

@cxnvass
Use analogReadMillivolts()

This function is used to get ADC raw value for a given pin/ADC channel and convert it to calibrated result in millivolts.
uint32_t analogReadMilliVolts(uint8_t pin);
pin is GPIO pin to read analog value
This function will return analog value in millivolts (calibrated).

You will need to use a voltage divider on your 5V input. The values for the resistors will depend on the ESP32 module/board you are using.