If one eats dairy then immediately eats a food prepared in a pan usually used for meat is this a problem? What happens if then followed by more dairy?
There is no problem of eating food prepared in a meaty pan after eating dairy.
After eating food cooked in a meaty pan, it is permitted to eat dairy.
See Rema 89:3. According to most poskim, this is true even if the meaty pot was not entierly clean (see Shach 89:19; Chochmas Adam 40:13; Aruch Hashulchan 89:13; Darkei Teshuvah 89:42). It certainly applies even when the meaty pot was a ben yomo, and even when sharp foods were cooked (see Darkei Teshuva in name of Rabbi Akiva Eiger).