in summary
Plants and animals both carry out respiration but only plant carry out photosynthesis
Animals obtain oxygen for respiration and get rid of carbon dioxide from respiration by breathing (lungs)
Plants get rid of gasses from the leaves and into them by diffusion
Note I didnt say which gasses go in and out of the leaf as that would vary according to the light levels ie at night there would be a net movement of oxygen in and carbon dioxide out. In the day the reverse, as much more oxygen is being made than being used and much more carbon dioxide being used as being made (because of photosynthesis)
Some people recommend that you take plants out of the bedroom in the night as they take up oxygen, in some hospitals this is a policy! It is total nonsense of course because the amount of oxygen used by a plant is a tiny fraction of that used by a person, and you have no problem sharing a room with another person at night.