This is a book I would have read some time in the 90s in the UK. I'm fairly confident it's not a Doctor Who book, but it had a very Doctor Who feel, at least in the parts that stick in my memory. It involved one or more viewpoint/reader surrogate characters traveling in the company of an experienced mentor. My memory is vague enough that I'll talk about traveling through space to another planet, but it might actually involve time travel to some location on Earth, and so on.
What I remember is that the protagonists arrive at a location - which I think was a castle or similar, but may have been more modern/futuristic - where they realize a dangerous being (possibly the only living thing left) is lurking, and they have to flee. The being is some kind of amorphous alien, like a slime mold with a black body and red "fruit" on stalks (or possibly red with black fruit) - see this image of Comatricha nigra from Wikipedia for what I mean:
(It's possible this description is accurate to how it appeared on the book's cover, but not fully accurate to the text - or vice versa.)
The being can either move, or spread by growing along the floor. The mentor figure views it as an extremely dangerous threat - I think it's described as some kind of superintelligent interstellar dictator, or similar. (I definitely have the impression it was a person and dangerous because of its plans and actions, not just an infestation dangerous because it would consume everything, or anything like that.) While I don't really remember the plot, I think it was along the lines of the characters arriving at this place, being surprised that it's deserted, discovering that the being is the reason it's deserted, and having to high tail it out of there before it gets them too.
It's probably obvious why I say this sounds like a Doctor Who story. I don't even remember any mention of them arriving by ship or similar, so a TARDIS would fit. However, I was reading actual Doctor Who novelizations around that time and I expect I would have recognized if this were one - unless I did, and simply forgot. I don't see a cover on the Doctor Who wikia (here or here) that looks right; I'm reasonably sure the creature was featured on the cover, spreading/moving around a corner towards the protagonists, and it was visually memorable. I don't recall ever hearing of such an entity in Doctor Who from any other source. I read it at a relative's house, so it's possible it was part of some larger series or franchise and I just picked up this one book out of context.