First, we need to check the ignition. Sometimes similar problems occur when the reel needs to be changed (if the case is in the coil, then the engine also works unevenly).
But most often, if there are no problems with the engine, the reason for the incorrect operation of the gas distribution mechanism (GRM). In some cars, it's a factory defect. After diagnosis, it appeared that the tags of the GRM did not match.