What happened was that Papyrus accidentally absorbed the souls when trying to stop Flowey from doing so. Since he’s rejecting the souls, his body is constantly fluctuating. He’s trying to maintain his normal form while the souls are trying to change his body into something that can handle the excess power.
Flowey’s kinda in Papyrus’ death grip. Being so close to something so unstable pretty much caused him to melt into Papyrus as well. So they’re kind of an amalgamate in a way.
* Papyrus managed to pull himself together when he bumped into Asgore again. Asgore thought that Papyrus was sick so he offered him to recover in an empty room that he has in his house.