Could you explain me, why sometime you connect led (-) with resistor to the GPIO pin but some time you connect led (+) with resistor to the GPIO. Reference from ESP32 Digital inputs and Outputs and ESP32 PIR motion sensor.
Looking forward from you
This is to do with sinking/sourcing current. There are good articles at https://www.dataq.com/blog/data-acquisition/whats-all-this-sink-and-source-current-stuff/. and https://startingelectronics.org/articles/current-sourcing-sinking/