Baby constipation

So we used prune juice to get him regular again last week but it's been about 3 weeks now where his poops just haven't been the same! They used to be very runny and almost consistently like diarrhea but now they're paste-like, smaller and today he passed what almost resembled an actual solid turd! What can I do to help him long term? He seems uncomfortable. Switch formula? Help! 😥