Theory:

There are $$7$$ trillion nerves present in the human body to transmit signals about the environment to the brain or CNS. Do you think all the $$7$$ trillion nerves are directly connected to the brain? The answer is no.

Important!
There are only $$12$$ nerves connected to the brain and $$31$$ pairs of nerves connected to the spinal cord to receive the signals from all body parts. These nerves branched to the different parts of the body and make up $$7$$ trillion nerves.
The brain and spinal cord belong to the central nervous system (CNS), and the information about the environment is transmitted to the CNS by the nerves connected to the brain and spinal cord. These nerves together form the peripheral nervous system (PNS).
Peripheral nervous system (PNS):
The PNS is made up of all of the body's nerves connected to the CNS (brain and spinal cord).

Picture showing the nerves of CNS and PNS

Cranial nerves from the brain and spinal nerves from the spinal cord form the peripheral nervous system. Both cranial and spinal nerves connect different parts of the body to the central nervous system. There are two types of nerve fibres in the PNS.
1. Afferent fibres
2. Efferent fibres
1. Afferent fibres or sensory division:  These fibres carry impulses from tissues or organs to the central nervous system.
2. Efferent fibres or motor division: These fibres carry regulatory impulses from the CNS to the peripheral tissues or organs.
The transmission of a signal by afferent and efferent nerves

Nerves from the brain and spinal cord enter the peripheral nervous system. There are $$12$$ cranial nerves and $$31$$ pairs of spinal nerves in the human body.
Cranial nerves:
The cranial nerves are a collection of $$12$$ nerves that emerge from the brain. Each has a distinct sensory or movement function. The cranial nerves have sensory, motor, or mixed functions:
• Sensory cranial nerves allow us to see, smell, and hear.
• Motor cranial nerves control muscle movements in the head and neck.
Example:
The optic nerve that innervates the eye enables us to see. Motor nerves innervate the eye allows for eyeball movement.  It also innervates the eye muscles, iris muscles and tear glands.
Each nerve has a number assigned to it based on its location in the brain and a name that reflects its function. The cranial nerves in the brain are labelled with Roman numerals ranging from I to XII.

The below picture depicts the twelve cranial nerve fibres names, location and their functions.

Picture showing the cranial nerves of the brain
Spinal nerves:
In humans, $$31$$ pairs of spinal nerves are there, that emerge from the spinal cord. They are classified according to which regions of the spine they emerge from, such as the cervical, thoracic, lumbar, sacral, and coccygeal spinal nerves.

Important!
A dorsal sensory root and a ventral motor root exist in each spinal nerve. In the dorsal spinal root, impulses are directed towards the spinal cord, while in the ventral spinal root, impulses are directed away from the spinal cord.
Spinal nerves are divided into five categories.
1. $$8$$ pairs of cervical nerves
2. $$12$$ pairs of thoracic nerves
3. $$5$$ pairs of lumbar nerves
4. $$5$$ pair of sacral nerves
5. $$1$$ pair of coccygeal nerves
The regions of the spinal cord and nerves
Reference:
https://en.wikipedia.org/wiki/File:Afferent_and_efferent_neurons_en.svg
https://commons.wikimedia.org/wiki/File:Blausen_0284_CranialNerves.png
https://www.pngjoy.com/preview/f5v3p9k5b4g8u4_spinal-cord-illustration-transparent-png/
https://commons.wikimedia.org/wiki/File:Figure_35_01_01.jpg