Fatal error: driver/temperature_sensor.h: No such file or directory

As per release page, PlatformIO’s standard espressif32 platform uses Arduino-ESP32 v2.0.16. The files from your Arduino IDE show that you are using Arduino-ESP32 3.x. As thus, the file won’t be found in PlatformIO.

You can make PlatformIO use Arduino-ESP32 3.x as per Making Sense of the upload Behavior of an ESP32C3 SuperMini - #5 by maxgerhardt or Problems with alternative ESP32 arduino core 3 - #2 by sivar2311

PlatformIO does not use any Arduino package files. It has its own package management. All configuration must be done via the platformio.ini per above.