The plots of Sherlock and Doctor Who are being shaped by their fans – but hit shows must appeal to the widest possible audience as well as a narrow band of obsessives

Doctor Who and Sherlock are linked by inspiration – Steven Moffat and Mark Gatiss write for both – and by impact: the shows were awarded the prime seasonal drama slots on Christmas Day and New Year's Day respectively. But those special editions also demonstrated another connection between them: these series are significantly redefining the relationship between television programmes and fans.

For most of the history of TV drama, fans have been on the outside looking in. New episodes or series were released by the creators for consumption by the audience, whose only possible effect on the product was to raise or lower the ratings figures that might influence whether a new series was commissioned. More recently, websites and social media have changed beyond recognition the way in which a show is watched, through preview, real-time and review discussion between viewers. But again, this had relatively little impact on the product, apart from recent cases such as Arrested Development and Ripper Street, in which digital petitions won a streamed reprieve for a franchise cancelled by a network.

Both the 25 December Doctor Who episode and the 1 January Sherlock were, without actually being interactive, crucially responsive to fan reaction. Written by Steven Moffat, The Time of the Doctor included a plot twist that granted the Time Lord another dozen physical regenerations, thus resolving (at least in the minds of the producers) the problem, much discussed on fan sites, that according to the rules originally set down, the Doctor was permitted only 12 embodiments.

And, writing The Empty Hearse, the first Sherlock of the 2014 run, Mark Gatiss seemed even more blog-aware. A running gag in the script utilised and satirised the wild and sometimes lurid online speculation in the real world about the circumstances in which the detective had apparently been able to fake his death in a rooftop fall at the end of the second series in 2012. Two lengthy sequences proved to be fan fantasies dreamed up by characters within the drama who were as obsessed with the fate of Sherlock as are viewers on the outside. These internal theories included elements (the medical effects of squash balls, an alleged homoerotic charge between Holmes and Moriarty) that have been aired in external fan fiction.

This sense that the characters are able to see through the screen into our world – in the way that a figure in a stage play will sometimes break the fourth wall and talk to the audience – was employed in different ways and for contrasting reasons. In the case of Doctor Who, Moffat intervened to settle the issue of the protagonist's longevity, which, for obsessive viewers, would have become an elephant in the writers' room, with all episodes of the Capaldi reign being viewed and discussed by some through the prism of whether he was or was not the final Doctor.

With Sherlock, Gatiss cleverly took advantage of the fact that Benedict Cumberbatch's character is a celebrity both within the show's world and in the real one outside, in order to have some meta-fictional fun. Such teasing of bloggers and tweeters was also appropriate because Sherlock has always been one of the most web-aware shows, among the first to find a satisfying way of representing electronic chatter on-screen.

The risk of this approach, though, is that the stories become skewed towards the smallest audience that any programme has: the obsessives. While any successful TV drama these days should generate fan fiction, it can not afford to become entirely fan fiction itself. Even shows as successful as Doctor Who and Sherlock should be aiming – especially given the accumulating publicity they receive – to introduce new viewers, and there were stretches of The Time of the Doctor and The Empty Hearse that must have been almost incomprehensible to new or casual consumers. The sections involving the number of Doctorly regenerations and the way in which Sherlock cheated death sometimes felt like a chatroom for aficionados rather than a programme for a general audience.

It also struck me, watching both episodes, that these hit series about the Time Lord and the detective are both fan fiction in another sense as well: in both shows, Moffat and Gatiss took over and modernised characters that they had loved as TV viewers and/or readers in childhood.

And, for the first time, I worried that the franchises are inadvertently merging. Although there has always been an overlap between the main players – both the Doctor and Sherlock are hyperlogical eccentrics who either literally or metaphorically come from a different planet from their awestruck assistants – The Empty Hearse felt oddly Whovian for a Sherlock.

This was partly because the plot tended to the apocalyptic – an attempt to blow up London, rather than a left-handed man found dead in a locked room – but also because there seemed to have been an attempt to make Holmes more whimsical and romantic, in the line of recent Time Lords. Although Cumberbatch played beautifully a scene in which the supposedly dead sleuth surprises Watson as a French waiter in a restaurant, the conceit felt closer to the natural acting register of David Tennant or Matt Smith than to Cumberbatch's drier, darker style.

There is already a much-watched YouTube mash-up of the Doctor meeting Sherlock, and a meeting between these main men sometimes seems an almost inevitable future episode of Doctor Who. Or, perhaps, when Cumberbatch's flourishing movie career makes him unavailable to Sherlock, the character will simply fall to the floor and morph into Tennant, Smith or someone else. The fan sites would love it, but, as recent episodes warn, a hit show needs to bear in mind the broadest audience.