GI specialist. Specialist would rule out other disease otherwise this is commonly ibs.
Hist/phys/diet/labs. Thorough history, including timing of sympt, effects position, diet, travel. History re: medl conditions, surgical history, meds, supplements, beverages (carbonated, lactose, fructose containing, alcohol, etc). History may give answer. Physical exam, including gi, and gyn, but also neurol, stool exam; appropriate labs, including cbc, chem, maybe others like sono, xray, endoscopies, etc., . If needed.