Uber Technologies Inc. on Tuesday reported that it swung to a profit in the second quarter, and that gross bookings and revenue doubled year over year, but investors still drove its stock down in extended trading.