Assuming it's level 32+. I don't think this would affect the results, but what about catching the Pokemon causing the level up vs gaining the exp prior to the capture, like if you leveled up in an SOS battle?
Edit: To clarify, you have an empty space in the party, and the level up happens in the same battle where you catch the Dark Type.
Asking about Gens 6-8.
If you leveled up Paschal then caught the dark type (assuming you have a space in your party) pancham wouldn't evolve. But if you caught a dark type and it was in your party THEN pancham leveled up, pancham would evolve.