This popular sensor made by Sharp produces an analog output that varies from 2.5V at 20cm to 0.4V at 150cm.
The sensor has a Japanese Solderless Terminal (JST) Connector. You can purchase a pre-made cable with connector that mates with this sensor. See 3-pin Cable for Sharp Sensors (30cm) or 3-pin cable w/Male Pin Header for Sharp Sensors (30cm).
For limited period, the sensor comes with a 3-pin cable approx. 20cm.