The capillaries only from the vein or artery to explain please
Capillaries' function is to carry blood away from the body and at cellular level, it exchanges nutrients, waste, and oxygen with tissues.
Arteries supply pure oxygenated blood to the capillaries which reaches to various tissues and cells of the body where exchange of oxygen and carbon dioxide takes place. Capillaries are connected to both veins and arteries thus playing the dual role in exchange oxygen as well as carbon dioxide.
The carbon dioxide released from the tissues enters the capillary walls in the red blood cells and from there reaches to veins. These veins then transport deoxygenated blood to the heart and lungs after receiving it from the capillaries.