The railway sleeper is gradually being destroyed by a fungus that lives on dead wood. What you pulled out is the spore head of the fungus - a bit like the flower on a plant. Most of the fungus is living deep inside the timber. You urgently need to treat the old railway sleeper with an oil-based wood preservative before it rots away.
Unlikely to be mushrooms - more likely a fungus of some sort.
Check your roof, You are getting water in somewhere.
We have recently rebuilt our fireplace and about this time last month a mushroom had grown out of the side of it. We pulled it out hoping it wouldn't grow again because its roots came out as well. It is an old railway sleeper that we have had in for a couple f months now and today I have noticed another mushroom in the same place.
Any ideas on how we can stop this?