You can bring solid food through security. A sandwich? Yes. A bag of chips? Absolute yes. A whole, uncut pineapple? Technically yes, but the agent will judge you so hard. However, anything that even looks like a liquid—like yogurt, peanut butter, or hummus—will be seized faster than you can say "protein source."
I once had a security guard stare at my container of tzatziki sauce like it had personally insulted his mother. He held it up, frowned, and dropped it in the trash. I still mourn that sauce. The rule is: if it’s spreadable, scoopable, or goopy, it’s a liquid. Don't test the system.
Also, if you’re bringing a birthday cake (yes, people do this), it has to go through the X-ray. The agent will not wish you a happy birthday—they will just ask if it has any liquid filling. It’s the cold, hard truth of air travel.