Liquids are easily absorbed into your bloodstream through your lungs(as long as it’s small amounts) and either eliminated through your kidneys or used by the body.
Solids are harder and you will, generally, cough them “up” to at least the point where your esophagus and wind pipe separate so that your body can move it into your stomach.
If they are small enough particles they can also be absorbed into your blood stream over time.
If they are somewhere in between small enough to be absorbed and large enough to be coughed up then it will be surrounded by a layer of mucus and your body will(very, very slowly) break up the food and carry it away like any other waste.
The cells in your lungs have tiny hair like strands that beat and move substances up and out of the lungs.
You constantly produce mucus in the lungs that will trap small debris/pathogens and it gets passed up and usually then swallowed where stomach acid kills the pathogens.
These hairs don’t work in people with cystic fibrosis and they need help to clear the lungs with massage.
Edit: spelling of mucus
other times it stays in the lungs neither being absorber nor removed such as the time a [tree was growing in a guys lung](https://www.dailymail.co.uk/news/article-1169861/Shocked-Russian-surgeons-open-man-thought-tumour–FIR-TREE-inside-lung.html), who supposedly inhaled a seed and it sprouted inside, the doctors thought it was cancer
Latest Answers