2007 Mazda 3 falling out of drive

The problem is that when it is in Drive, it will “fall out of gear”. I put that in quotes because it is still in drive, but it was shift up to a higher gear if i don’t physically pull the gear selector knob back. For example, if i’m driving and the car is in 4th gear going 60mph, and the shifter nob slides up an eight of an inch, the D light will go off and the car will move into a higher gear (not sure which one, feels like 2nd or 3rd) and the engine will rev up. It doesn’t feel like neutral.

I would suggest you have broken engine mounts causing the transmission to pull on the transmission shift cable.

Do this un a wide open space with nothing in front of the car.

Open the hood, start the car, put your left foot on the brake, shift to drive. The engine should move a little. Press hard on the brake with you left foot. Press lightly on the throttle with you right foot and watch the engine. Does it move a little? A lot? Does it seem like it pops out of gear? That would be a broken engine mount.

would that make sense if it only has this problem in drive and if im ever holding the shifter back then it works fine and the drive light will stay on and alot of times it stays in drive.

could it also be that I just need to adjust the shift cable?

Yes, it could be the issue.