I'd remove the pipe and do a daily 20% water change with a gravel cleaner until there is a sign of improvement. If you have any test kits check for raised levels of ammonia or nitrates.
If they are Planaria then it's a good sign your overfeeding. Even though Planaria do not harm fish, they are an indicator that the aquarium has a problem. They require a food source, which means there must be excess food wastes in the tank to support them.
Looking at the pipe and the goldfish next to it, the opening is to big if it's for breeding your BN's.