You're supposed to eat candy after you picked it up, that's why the candy disappears as soon as you walk on it because the candy UI counter will update and tell you how many candies you have in your inventory so that you can use it to eat and restore health, as one person just mentioned already.