Consumable Items
To make your item consumable, go to its Script Editor and use 'Set Consumable Component' in the item creation event.
Note that this node only works from 1.21.4 onwards.
Consume Action
You can run a script every time the player consumes the item with the 'Consume Action' node.
Food Component
To make your item food, in addition to making it consumable, you will also need to set the Food Component.