Gray matter contains neuronal cell bodies, dendrites, and unmyelinated axons, giving it a grayish appearance. White matter consists primarily of myelinated axons, which makes it appear white. These two types of matter work together to process and transmit information within the brain and spinal cord.