What is the difference between the PMS5003 and the SDS011?
The PMS5003 offers more particle sizes and a longer rated lifetime. The SDS011 offers a wider particle range.
Which is better for air quality, the PMS5003 or the SDS011?
Both measure particles: the PMS5003 reports PM1, PM2.5, and PM10 up to 500 µg/m³, the SDS011 reports PM2.5 and PM10 up to 999.9 µg/m³. They also differ in supply, lowest average current, and rated lifetime: see the table above.
Can I replace the PMS5003 with the SDS011?
Often yes: both use a UART. Change the driver or, in ESPHome, the component (pmsx003 → sds011).