Switching formula without doctor?

My baby is only 4 days old. He’s normally very calm and content. He does cry when he’s hungry, diaper needs changed, the normal stuff. The past 2 days he’s been very fussy and screaming crying throughout the night while trying to poop. His poop is coming out very dry and pebbly like almost like he is constipated. Ive been up now all night with him (around 10 hours since we’ve all slept) and fed him every 3 hours and every time he would just scream and try to poop/pass gas until his next feeding. I am exhausted and i feel so bad for him because i know something is wrong. My doctors office is closed today so that’s why i did not call them. They also told us his formula was fine to keep giving to him so

I had a sample of a sensitive formula of the brand i was using and i gave him that instead of the regular one i normally feed him. I don’t want him to be in pain!! I hope that’s okay i don’t know what’s right or wrong but it shouldn’t hurt him using a different formula should it??