Greetings! U could have a bad mass air flow sensor. This is very common and can cause you vehicale to loose power along with many other drivabilty issues if the sensor is bad. The Mass Air Flow (MAF) sensor uses a hot wire sensing element to measure the amount of air entering the engine
The MAF sensor then outputs an analog voltage signal to the PCM proportional to the intake air mass. The PCM calculates the required fuel injector
pulse width in order to provide the desired air/fuel ratio.
If the sensor is bad than this air/fuel ratio will be off.
This input can also be used in determining transmission
Electronic Pressure Control (EPC) , shift and torque converter clutch scheduling.
Some MAF sensors have Integrated Bypass Technology (IBT) with an integrated Intake Air Temperature (IAT) sensor.
The MAF sensor is located between the air cleaner and the throttle body or inside the air cleaner assembly.
Also I would rec to check the air snorkle between the mass air flow sensor and the throttle boby. This can not have absolutely any crack, rips or tears. If so, air will enter the engine thats not accounted for and cause driveability problems! Because you have described it getting better going from N to D, this tells me that this could be the problem! The engine rocks back and forth when u do this and the mass air flow sensor stays put. The rubber air snorkle takes the hit by expanding and contracting. Look carefully between the ribs on the snorkle. I would even rec to take it off and inspect it.