I don't know why it is so difficult for some to fathom, but collecting wood from any local area is highly risky. If you do, it must be hardwood (oak, beech, similar). It must be completely dead dry throughout, which means not from a watercourse/pond/lake, and off the tree long enough that no sap remains and the wood is brittle; twigs and smaller branches will usually be safe like this, but larger thick chunks...you can never know. And the area must be "safe," meaning not close to industry, roads, farms, etc.
Coniferous trees are soft wood, and have cones. They usually have needles, and are evergreen. Pine, spruce, fir, hemlock, juniper, cedar. Never use these as their sap is toxic. Also, being soft wood, they more readily absorb and retain liquids that are often toxic in themselves, and they will rot much faster and I understand this breakdown also releases toxins from these woods.
Never collect wood from water because it will likely contain pathogens. Someone mentioned "fish in the wild are OK with it"...no, they are not. In nature the water volume is considerably greater than in a closed aquarium, and fish can easily "swim away" but not in the aquarium when some toxic substance begins to leech out. Also, local fish are immune to local pathogens to some degree, but tropical fish are not because the pathogens in tropical and temperate zones are different (some of them). This is why it is never safe to release any tropical fish/plant/snail into the local ecosystem.
An illustration. Back in the 1990's I had a problem with the fish in one tank that slowly beecame more and more lethargic; new fish would die overnight, but the cories that had been in the tank for a couple years sat on surfaces respirating rapidly. I tested everything I could, and finally consulted the curator of freshwater tropical fishes at the Vancouver Aquarium who was also a keen hobbyist. The end result is, it turned out to be some toxic substance leeching from a huge chunk of wood (in hindsight I believe it was cedar) which I had purchased in a fish store. I removed all thee wood, and after a complete tear down the issue was gone and the fish recovered. During our discussions, the Curator told me of a collecting trip to South America he made a couple of years previous, and he brought back some Apistogramma along with the native leaves that were lying on the substrate and which the species used in spawning. Back home, after several weeks, the cichlids overnight showed severe signs of a problem, and were all dead within hours. Tests revealed that the leaves had released a natural toxin as they decomposed. In the natural habitat, the fish had no issues because the water carried the toxin downstream; but not in an aquarium.
A few dollars saved is not much of a saving if your fish weaken and die.