10K Potentiometer with Arduino Uno and 5v works but same pot with ESP32 and 3.3v floating values
According to this posted answer, Why do many electronics operate on 5 AND 3.3 Volts?, 5v provides better noise immunity than 3.3v so the Arduino Uno with 5v has less problems with a potentiometer in a 5v circuit than the ESP32 with a potentiometer in a 3.3v circuit.
This article from EE Times, Electrical noise and mitigation – Part 1: Noise definition, categories and measurement, has this to say:

The best illustration that can be given of this condition is to
consider where the signal voltage has been and what is happening to it
compared to the noise voltage (see Figure 8.5). In years gone by,
signal voltages may have been 30 V or more but since then have
steadily been decreasing. As long as the signal voltage was high and
the noise voltage was only 1 V, then we had what most instrument
engineers would call a very high signal to noise ratio, 30:1.
Most engineers would say you have no problem distinguishing the signal
as long as you have such a high signal to noise ratio. As the
electronic equipment industry advanced, the signal strength went down
further, below 10 and then below 5. Today we are fighting 1-, 2- and 3
V signals and still finding ourselves with 1, 2 and 3 V of electrical
noise. When this takes place for brief periods of time, the noise
signal may be larger than the actual signal. The sensors within the
sensitive equipment turn and try to run on the noise signal itself as
the predominant voltage.

See this answer Capacitor in circuit for potentiometer?.
From Instructables: Smooth Potentiometer Input

Sometimes, actually in most cases, potentiometers produce a jittery
signal. This can be due to low quality material used to make the
potentiometers. The jittery signal can be very irritating, especially
if you are using the pot to control a sensitive output. That is why
you need to look for a way to make the input smooth.
To smooth out the pot input, you should use a low-pass filter. It
removes all signals that have a frequency that is above the set
cut-off frequency. You determine the cut-off frequency by adjusting
the values of capacitance and resistance in the circuit.

See also Wikipedia topic Low-pass filter

One simple low-pass filter circuit consists of a resistor in series
with a load, and a capacitor in parallel with the load. The capacitor
exhibits reactance, and blocks low-frequency signals, forcing them
through the load instead. At higher frequencies the reactance drops,
and the capacitor effectively functions as a short circuit.


See also De-coupling which notes &quot;Once you get more than a handful of active components together you need to de-couple the power supply. What this is, and why, is described here.&quot;

When an otherwise good design works, but is erratic, unreliable or
just goes crazy then nine time out of ten it is the power supply
de-coupling. And you will find that the tenth time, turns out to be
power supply de-coupling as well. So what is it, and why is it needed?

See as well The Ultimate Capacitors Guide: Learn How To Use Them