That’s expected, since nn.BCEWithLogitsLoss expects logits (remove the sigmoid activation) while nn.BCELoss expects probabilities (use sigmoid here).
Generally using logits and nn.BCEWithLogitsLoss is the recommended approach as it has better numerical stability.