DIAGNOSIS That's a classic sign of a dying remote battery. The signal is weak, so it only works at point-blank range.
FIX Replace the battery in your remote. It's almost certainly a standard CR2032 coin cell. 1) Slide open the back of the remote. 2) Note the orientation of the old battery (plus side up). 3) Pop it out and put the new one in. 4) You shouldn't need to reprogram it. Test it from your car. While you're at it, check the antenna on the motor unit. It's that thin, hanging wire. Make sure it's not coiled up or tucked away—it should be dangling straight down.
IF THAT DIDN'T WORK Local radio interference can also kill your range. New LED garage lights, a neighbor's security system, or even a baby monitor can flood the frequency. Try operating the opener with all other lights in the garage turned off. If range improves, the light is the culprit. You may need to replace it with an opener-compatible bulb or put a ferrite choke (a little clip-on noise suppressor) on the light's power cord.
HEADS UP If you have multiple remotes and only one is weak, it's the battery. If all remotes and the keypad have short range, the problem is with the opener's receiver or antenna.