I replaced the bulbs and inspected the sockets. All good.
I checked all the connections in the rear of the car and everything seems fine there. And all the Earth's look good to. I checked ohm readings from earth in the socket to the frame and that is good.
When I have both bulbs out I checked the sockets with a meter, and everything there is working properly.
The issue is when the side lights are on and the brake pedal is pushed. It must be a problem with one wire somewhere, but I haven't found it yet