From the Super Mario Wiki
Stretch Blocks are blocks composed of five segments which constantly extend up and down or left and right. They first appear in Super Mario World, where they serve as a bridge in certain levels. Stretch Blocks also make an appearance in Super Mario Advance 4: Super Mario Bros. 3 where they only appear in the World-e level, Tā-kun ni Ki o Tsukero serving the same purpose.
Stretch Blocks make another appearance in New Super Mario Bros. Wii, where they appear at the end of World 9-2. In this game, they again serve the same purpose as they did in Super Mario World. However, these blocks will move up or down as they extend on both sides.
Stretch Blocks make their latest appearance in New Super Mario Bros. U in Rock-Candy Mines as an integral part of navigating the world. They also appear inside some levels with the same appearance of New Super Mario Bros. Wii. This time, however, they blink just before they stretch or retract.
 See Also