I've got ½" M-M with female ratchet sets, but F-F? Female square to female hex are used for lug nuts, but tapered rod.
My guess would be for removing plugs - they mostly have square heads. I'm thinking steel/cast iron/ malleable iron. Most brass plugs have hex heads.
1/2" plug is .56" square, 3/8" is .44" square.
For fire protection our smallest is 1/2" where sprinkler heads thread in.
Double check the dimensions, if both are right at 1/2" I am off on my guess.
Another possibility is a drive shaft as part of an assembly. I would think that the holes would be longer than needed for a drive tool extension.
Chilly