If you have acidity symptoms such as heart burn, acid brash, acid regurgitation, gastritis, peptic
ulcer then you would need medications such as antacids, H2 blockers and proton pump inhibitors to counter the action of the acid.
So Prilosec and Nexium fall into the class of proton pump inhibitors. Do not self prescribe and I would suggest you to follow up with a gastroenterologist for a proper diagnosis and for titration of the dosage for you.
Take care!