In survival mode, this only works if you actually have the block you’re facing. Otherwise, nothing happens. And in creative mode, whether you have the block in your inventory or not, it will always ...
You are going to need a lot of blocks for this build so you should better get to farming. As for the blocks themselves, you can pretty much use anything. Cobblestone and Wood are the most common ...