Infants (more so, newborns) don't yet know how to initiate urination or defecation: so they do strain much & accidentally/rather inadvertently pass urine & stool.
But crying during passage of urine can indicate UTI (urinary tract infection) (with girl infants are more prone): usually urinary infection results in frequent passage of small quantity urine, fever, vomiting, blood stained urine, etc
Next Steps
since urine routine test is rather inexpensive, it is always wise to rule out UTI
Health Tips
collect urine (especially if girl) using Pediatric urine bag, for ease of collection
hand over fresh sample at lab without delay, as results can otherwise get skewed!