Cookies are food items that can be obtained in large quantities, but do not restore hunger or saturation significantly. To eat a cookie, press and hold use while it is selected in the hotbar. Eating one restores 2 hunger and 0.4 hunger saturation.
Journeyman-level farmer villagers sell 18 cookies for 3 emeralds as part of their trades. In Java Edition, if the player has the Hero of the Village effect, a farmer villager may gift them a cookie.
Read more about cookies on https://minecraft.fandom.com/wiki/Cookie