Why are spinal nerves considered a part of PNS while the spinal cord is a part of CNS?
CNS consists of brain and spinal cord, and PNS consists of everything else


That's really it. The distinction is slightly arbitrary, I'd think of them as the central (nervous system) and the peripheral (nervous system): that is, the most important part is that together they are parts of the nervous system, rather than being distinct systems; the central/peripheral difference is fairly minor, especially if you are thinking primarily of the somatic part of the peripheral nervous system (that is, not the autonomic part) relative to the associated part of the CNS.

The peripheral part of the nervous system is not protected by the bones of the skull and spine, does not have the protection of the blood-brain barrier (specialized endothelial cells and astrocytes that limit transmission of molecules between CNS and the blood circulation moreso than in other tissues), and myelination is mediated by cells with a different morphology: Schwann cells in the periphery vs. oligodendrocytes in the central. That's about it.