I've had various conversations with the local police about close passes and one officer suggested a flag. The commercial ones are just 32cm long as made of orange plastic with red reflectors. But 32cm even if mounted on the outside of the pannier rank isn't much further out than my handlebars.

So this was my Mark 1 flag. It's the tip of an old fishing rod with a flag made of fluorescent fabric, edged with reflective tape. Its mainly held in place by the spring loaded bit of my pannier, supplemented by a couple of loose zip ties and a bit of my pannier rack elastics. If hit, it would deflect. It's 62cm long the same as my handlebars so I could pull it across when in cyclepaths and know it won't get in anyone's way. It makes my effective bike width about 90cm.
The flag seems to help with urban and single carriageway country roads so I started to think about improvements.
One issue is that flag needs to be able to pushed out and pulled back in - Eureka moment - telescopic.
So this is my DIY telescopic safety flag.
Update
In the middle of January, I was cycling along a single track road with passing places and I was aware of a car behind me, giving good space but wanting to pass. Moving left, I hit black ice and ended up sprawled in front of the car. The driver was very good, scooped me up and drove me home while another woman took my bike into her garage. The driver commented that my flag was very visible.
I’ve a broken leg and a new flag.
Simpler construction with just a rectangle of fabric and reflective material on one side, reinforced with stitching. And I popped a reflector on the end. The telescopic pole is a hand held telescopic flag pole. They come in a range of lengths but this one, 120cm long which then could extend about 90cm beyond my handlebars is plenty long enough. I doubt I’ll fully extend as it’s loooong.
Materials
Telescopic inspection tool e.g. https://www.screwfix.com/p/hilka-pro-craft-32-telescopic-magnetic-pick-up-tool-led-light/5873r
Reflective tape
e.g. https://www.amazon.co.uk/gp/product/B07GWQNVC5/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1
e.g. https://www.amazon.co.uk/gp/product/B07GWQNVC5/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1
Making
Cut a blunt triangle of fabric about 10 inches long and 8 inches deep. I made the top edge 2 segments of telescope long.
Fold over the top and stitch a channel wide enough for the inspection tool to thread through.
I found the handle of my Rolson inspection tool would pull off. If it doesn't for you then stitch with the tool inside the channel.

I chose red and white diagonal stripes as this is the standard for wide loads and it looks pretty visible to be in all conditions.
Turn over the flag and fold in the overlaps. I made a tiny error here and forgot to leave the channel open at the pointy end as well as the start of the channel and had to trim later.

I then edge stitched the whole thing (remembering to keep the channel free)
Slide the telescopic tool through the channel and reattach the handle.
Use the Velco ties to attach the handle of the tool under your saddle. I found that if I walloped the end of the tool, the whole thing would twist but not fall off. I didn't want to the attachment to be so solid that there was an risk that a collision with the flag would significantly destabilise the bike.
The whole thing retracts for cyclepaths and can be extended as far as you feel necessary. I find that partially out is good in urban areas and I extend it fully when dealing with roads prone to psychopaths. It's 75 cm from my mid line when fully extended. Apart from when fully extended, I can reach sideways and pull the flag in and out while riding.
On country roads I now have vehicles waiting behind for a safe pass rather than squeezing through. I am scrupulous in giving them a thank you wave or thumbs up, even though my belief is that this good behaviour is more out of concern for their paintwork than cyclist safety.