From the Super Mario Wiki
A Yoshi Platform is a flat rectangular prism created when Yoshi sprays his juice on enemies (such as Boos and Cheep Cheeps) from Super Mario Sunshine. It is the color of the Yoshi spitting the juice, and moves according to its color. Pink platforms move vertically upward, purple ones move horizontally, and orange platforms stay where they are until they disappear. Red Boos can make a Yoshi Platform when sprayed with F.L.U.D.D., not just Yoshi Juice. Mario and Yoshi can use the platforms to get to far away areas. They are mainly used in the episodes "Yoshi's Fruit Adventure" in Ricco Harbor and "The Hotel Lobby's Secret" in Sirena Beach.
Two enemies, Red Boos and Cheep-Cheeps, always revert to their regular appearance. Some enemies, like the Cataquack, are instantly defeated when reverting from their platform form to their regular form. Other enemies, such as the Giant Stu and Sleepy Boos, are completely immune to Yoshi's juice and therefore cannot become a platform.