IR is the most common as it's cheap and reliable for the sort of short ranges it's typically used for.
They typically use near IR, either strength of reflection or triangulation.
ST also do IR time-of-flight sensors initially aimed at phones etc. but also useable at longer ranges with more recent parts.
The big advantage of TOF is measurement certainy - if you have a good enough signal, you know the proximity value has to be right, so good where you want to know the distance, or want triggering at a well-defined distance as opposed to a simple "there/not-there"
Reflective sensors that use signal strength are much cheaper and simpler, but the signal varies a lot with target type - fine for washroom type applications where you just want a "there/not-there" indication at a fairly sort range.
Ambient light is fairly easily excluded with a combination of optical filtering (Extremely effective with LED lighting which has minimal IR) and modulation to ignore DC ( daylight) and most artifical light.
Capacitive is possible but has lots of issues, particularly noise pickup, that make it only useable in more niche cases where the environment is fairly predictable ( i.e. not anywhere that can be wet, or have wide variations in humidity, temperature, phase of the moon etc.)