The land stops and then there’s … nothing.” The playwright Tim Crouch, whose first TV commission Don’t Forget the Driver has just finished airing on BBC Two, is musing on his former home town Bognor Regis, where the show is set. As well as being part of a slew of top-quality sitcoms and dramedies that are making 2019 a golden year for British TV comedy, Don’t Forget the Driver fits a trend within the new breed of downbeat, single-camera comedy-dramas that have all but replaced traditional sitcoms in the schedules: if you want to accentuate the vibe of your weary antihero staring wistfully into a serio-comic abyss, film them by the seaside.

The southern edge of England has a particular resonance right now, as Brexiters celebrate the chance to shore up that frontier against marauding immigrants, while those dismayed by the prospect of losing our connection to the continent see our proximity to it as a painful irony. Don’t Forget the Driver is an explicitly post-referendum show, perhaps TV comedy’s first. Its story kicks in when Peter, the coach driver played by co-writer Toby Jones, helms an excursion to Dunkirk and discovers a refugee stowed away in his vehicle when he gets back to Bognor. For a hilariously timid and trampled-upon man, who is smart enough to know what the world could offer him but has never been brave enough to grab it – you can imagine him spending half his disappointing life staring impotently across the sea towards France – seeing that the young woman is at risk offers his last chance of redemption.

“We’re living at a time when Britain is questioning its identity,” Jones has said of Don’t Forget the Driver. “We’re an island culture and as soon as you’re on a coastline, you’re aware of everything else that’s just out there.”

Peter’s extended family is unthinkingly diverse, including his mixed-race daughter and the mysterious Polish man whom he allows to sleep in the coach overnight. But in the town, that multiculturalism is shown to be uneasy. “It’s impossible to write about anywhere in the UK without touching on those themes,” says Crouch. “But they’re more acutely felt in places like Bognor. There’s a vibrant Polish community, a tension between them and a notion of an indigenous community, which I would question anyway.”

As well as being on the border between our island and the outside world, the seaside is more generally the edge of society: people there are physically on the margins. Don’t Forget the Driver has two characters in their early 20s who dream of leaving, as so many young people do in places that are party towns in summer, but where in winter every day is like Sunday. “People escape to seaside towns,” says Crouch. “They have dirty weekends there. Seaside towns are perceived to be a pause in real life. Living in a place that has that quality, being forced to live a real life there, has a sort of bitterness to it.”

Coastal communities tend to be places that have been left behind – literally, by the visitors who pack up again and go home to the big cities, and by former residents who have escaped. Small seaside towns are politically left behind, too: recent studies have found that poor transport links, competition from cheaper foreign holiday destinations, and lower-quality schools have left coastal areas lagging behind inland urban centres, with poorer social mobility and lower wages.

That idea of areas that are beautiful but wasting away was memorably explored last year by BBC Two’s The Mighty Redcar, which was a documentary but one made with the storytelling sensibilities of a piquant dramedy. In it, residents defiantly celebrated their home town, with its close community and stunning sea vistas, even as they suffered its stark limitations.

“There’s something quite magical about setting things on the coast,” says The Mighty Redcar director Daniel Dewsbury. “The person who shot all our drone footage was from Redcar, and he was determined to show it in its best light. In one image, you quickly understand why people love the place. But that natural beauty is crisscrossed with the social realism of what’s going on there. We wanted to show how beautiful it was, and that there’s a reason why young people leave. The subtext is: isn’t that a shame?”

The contrast between infinite skies and hidden domestic misery has long been tapped into by British crime dramas, which since the success of the Bridport-shot Broadchurch in 2013 seem routinely to be set by the sea. Shows such as Shetland, Vera and Broadchurch-a-like The Bay tap into the idea of bad things happening in lovely places, while giving their detectives the chance to brood windily in the salty air.

BBC Three’s superb Back to Life, created by and starring Daisy Haggard, is set in a coastal town that doesn’t have a name but has visibly been filmed in Hythe and Dungeness in Kent. Her character, Miri, returns to where she used to live after 18 years away and receives a mixed reception. Traditionally in comedies that’s a simple case of a prodigal child not being welcomed home by those they snootily abandoned, but here the frostiness is intensified by the fact that she has just completed a stretch in prison for murder.

Daisy Haggard in Back To Life. Photograph: BBC/Two Brothers Pictures/Luke Varley

As a delicate, at times brutal, black comedy of awkwardness and isolation in a hostile small town slowly builds, the coastal location illustrates that Miri, like Peter in Don’t Forget the Driver, provides a nuanced modern take on another old comedy trope: she is trapped. “There’s all this open sea in front of her,” says director Chris Sweeney, “but she’s still blocked by it. Then she’s blocked in on the other side by the town who don’t want her. While it’s very open, it’s weirdly claustrophobic.”

Again, though, creating the desired vibe of wistful sadness meant utilising the cold beauty of the area. “Daisy wanted to make something that was like an American indie movie,” says Sweeney. “Films like Blue Valentine and Winter’s Bone are shot in beautiful landscapes, and it contributes to how you feel when you watch them. In America you’ve got a mile of desert, then a house, and then a mile of desert the other side. You point a camera at it and it just looks brilliant. Dungeness has the same thing, it looks cinematic really easily.”

Whichever coastal town a show chooses, they all share one more prosaic advantage: they are Not London. “Sitcoms and comedy-dramas that have done well for us recently,” says BBC comedy commissioning controller Shane Allen, “have a really specific sense of place: Detectorists, This Country, People Just Do Nothing, Peter Kay’s Car Share, Man Like Mobeen, Still Game. We commission shows on merit and distinctiveness, then ask two questions: where can this be set that isn’t London; and what are your plans for inclusivity around cast and crew?”

“To some degree I feel quite proud of myself for not having ever lived in London,” says Crouch. “It’s never been my base – I could never afford for it to be my base when I was young. People in Bognor are at peace with living in a smaller place. It’s not like London, and a lot of people would argue and fight for that quality to remain in Bognor Regis. I totally get that.”

Don’t Forget the Driver and Back to Life are on iPlayer now