From the Super Mario Wiki
A Boo Buddy Block is a strange combination of a Boo and a Block only found in Super Mario World and Yoshi's Story. When looked at, it seems to be a normal, gray block. But if Mario takes his eyes off it, it slowly begins to transform into a Boo. They are actually required to clear a certain Ghost House, as Mario must lure them towards him, turn around, and jump on and leap off them to reach a high ledge, where the exit door awaits.
The Boo Buddy Blocks in Yoshi's Story are simply called Boo Blocks (since they were actually normal-sized Boos rather than the smaller Boo Buddies). They appear solely in Stage 6-3: Ghost Castle, and instead of being a gray block they have pink and white stripes.
In Super Mario Sunshine, there are Red Boos which turn into solid platforms when squirted. These, too, are needed to complete certain levels.
Boo Blocks also appear in Mario & Luigi: Bowser's Inside Story in the Energy Hold.