Sensors look simple: plus, minus, signal. But there are four things that regularly go wrong, and none of them have anything to do with the sensor itself.
Voltage: 3.3 V or 5 V — and the signal?
Many sensors run on 5 V, others on 3.3 V. That part is straightforward. But the voltage of the output signal is a different matter. A sensor powered by 5 V also outputs a 5 V signal. Feeding that signal directly into a 3.3 V microcontroller — like an ESP32 or Raspberry Pi — causes damage. Sometimes immediately, sometimes gradually.
The solution is a level shifter, or for simple cases a voltage divider using two resistors. The CRG0805F10K (10 kΩ) and the CRCW0805330RFKEA (330 Ω) together make a simple divider that delivers a 3.3 V signal from a 5 V input. Note: this only works for slow, unidirectional signals — not for I2C or SPI.
Analogue, digital or bus
An analogue sensor outputs a voltage proportional to what it measures. An LDR or NTC gives a variable voltage; you read it on an analogue pin and convert it back to the measured value. Simple, but sensitive to noise on long wiring.
A digital sensor outputs high or low — a threshold is either exceeded or not. That's robust and easy to read, but you lose all nuance.
A bus sensor communicates via a protocol. I2C and SPI are the most common. I2C uses two lines (SDA and SCL) that multiple sensors can share, but requires pull-up resistors on both lines — typically 4.7 kΩ at 100 kHz. SPI is faster but uses four lines per sensor.

Cable length and noise
Long cables and analogue sensors are a poor combination. Every metre of cable picks up noise. A soil moisture sensor on 2 metres of wire stuck in the ground rarely gives stable readings — that's a cable problem, not a bad sensor.
For longer distances, choose a protocol designed for it: I2C works reasonably up to about 1 metre at normal speeds, SPI a bit further, but for real distance look at 1-Wire, RS-485 or a sensor with built-in signal processing.
Start small, build up
Test each sensor individually first: short cables, known power supply, a simple example program. Does it work stably and give expected values? Only then add more sensors.
Two sensors on the same I2C bus with the same address — that's a common mistake. Check the I2C address of every device in the datasheet before assembling the bus.
Common mistake
The connector fits, so it works. It doesn't. Check voltage, pinout and signal level before connecting. A wrongly connected sensor can damage itself, damage your microcontroller, or simply do nothing — and then you have no idea which of the three it is.