TSOP4838 is for remote controls, i.e., sending small data packets. Abusing it for obstacle avoidance is likely possible, but of unnecessary complexity.
I'd suggest, either go super simple and, in conjuction with the IR LED, use a bare plain old phototransistor: just connect the emitter to ground, and pull the collector up with a resistor, measure collector voltage, either with an ADC pin, or just a digital input pin. Adjust the pullup resistor value to set the sensitivity.
Or, if you want to go fancier than that, buy ICs for actual distance measurement. ST has a nice portfolio of completely integrated, one-chip solutions based on time-of-flight principles, ranging up to about two meters in centimeter accuracy. These work on I2C bus.