What sensor could I use in outdoor

Hello everyone. is IR proximity can work outdoor ? it will be expose into sunlight,wind,rain(weather) IR can detect through light right? or much better to use ultrasonic? which detect through sound waves? it won't be affected in wind? what do you think guys? pls help

There's a lot of IR in sunlight so you'd need to go for a sensor that uses modulated IR. Still it may be flooded by IR from sunlight.

Rain obviously can cause a problem for any sensing technique.

Which kind of IR? far IR (as in passive IR sensor), or near IR (beam-breaking sensor)

You can get special waterproof ultrasound transducers (as used for car reversing sensors).
In general electronics needs to be fully protected from the elements, so unless a sensor
is fully waterproof you will have to figure out how to seal it yourself.

I'm looking for any sensor that can detect any obstacles and the same time reading distance. someone say's I will use ultrasonic HCSR04 and I tried but even the wind can detect this kind of sensor. so we want to try another sensor that won't be affected by strong wind, light or rain (weather/temperature). that the distance and detection won't be affected. thank you in advance for your help :]

LiDAR can do a pretty good job in looking through pretty poor conditions, while not being affected by ambient light.

Then there's the problem of "any obstacle". You have to distinguish between heavy snowfall and a wall of snow, for example.