The wire is a pest. Can't recall if the connector is small enough to go through a ring spanner of the right size for the hexagon. If it isn't best to get a proper split ring spanner or split socket with offset drive so as to have good purchase on the sensor body.
The big imponderable is how tight years of heating and cooling have made the sensor in its thread. I'd need to be confident that it's not gone super tight before trusting to an open end.
Bought a relatively inexpensive Hilka branded set of two offset square drive split sockets to pull the Lambda sensor on my Yamaha GTS which fitted far better than I expected given the price and worked well. Set comprises one 1/2" drive and one 3/8" drive. But that Yamaha is silly low mileage, despite being 30 years old, and the sensors are known to come out easily if factory fitted.
I'd expect the P38 sensors to put up more of a fight so would push the budget to cover a proper split ring spanner from a good make.
I was impressed with the Gedore ones I bought to do the oil coolers and pipes last year. £60 odd for two spanners isn't cheap but they fitted really well and got things undone without drama where an open ended spanner would almost certainly have distorted the hexagon unions. Gedore claim to make their spanners more accurately than other makes. Something I'm willing to believe on the evidence of that pair.