What are the red lines for?
Those red lines are wire, which is used to connect triggers and mechanisms. Wire is invisible unless you're holding something that can interact with it, like the Active Stone Block, which becomes non-solid when activated by wire. In the underground, you will usually find it connecting pressure plates to various traps. You can check the wiki for more information.