That same logic could be applied for the save and discard button. Should there be a bigger gap between them lest somebody misclick and discard things instead of saving them¿? Atleast in the case where they accidentally click cancel instead of discard, they are not losing any data.
Hell if this really about data safety, discard/don’t save should be the isolated button because it is the only destructive option