I find omeprazole (Prilosec, Losec) and ranitidine (Zantac) work about equally well for stomach acid reduction.
For long term daily use, which is safer?
Before we discuss safety, I wouldn't agree that these two work 'equally well'. While ranitidine (a histamine 2-receptor antagonist - H2A) is a medicine with good efficacy, studies have shown that proton pump inhibitors - PPI (such as omeprasole) are more efficient. (1, 2)
One of these studies concludes:
Maintenance treatment with omeprazole (20 or 10 mg once daily) is superior to ranitidine (150 mg twice daily) in keeping patients with erosive reflux esophagitis in remission over a 12-month period.
As for safety, University of Oxford, Medical Sciences Division in a Systematic review of PPI and H2A in GORD states that:
The rate of occurrence of study withdrawals because of drug-related adverse events is shown [...]. For PPI, the rate of adverse event withdrawals was 2.5%, and for H2A it was 4.2%. This tendency for fewer adverse event withdrawals with PPI was significant - relative risk 0.61 (0.41 - 0.91). The NNH was 50 (26 - 251). This means for every fifty patients with reflux oesophagitis treated with a proton pump inhibitor, one will not have a serious treatment-related complication who would have done had they been treated with a H2A.
This refers only to serious complications. Detailed lists of possible side effects and their frequencies for each medicine can be found in their respective summaries of product characteristics - SPCs. (4, 5)
(Edit: For long-term effects and risks, many years may pass until they are discovered, which is why safety of medicines is constantly being re-assessed, especially through pharmacovigilance system. There have been some very recent studies showing that there might be additional long-term risks associated with use of PPIs, as explained in Count Iblis's answer).
However, in pregnancy ranitidine and other H2As have been categorised as class B medicines, whereas omeprasole has been categorised as class C medicine, the second being based on effects shown in animal studies. There is more data on safety in pregnancy obtained from humans for ranitidine than for omeprasole. Class B is regarded as safer than class C. Other PPIs are categorised as class B. (6)
Ultimately, the choice of medicine should be up to your physician, who knows the specifics of your condition and your overall health status. What's more, if the condition persists (you inquired about long term use) a medical doctor should follow your condition and the treatment progress.
Recent research results point to serious adverse health risks with the long term use of PPIs. These medicines increase the risk of heart disease, increase the risk of dementia and chronic kidney disease. These adverse effects have only recently been found. The association with heart disease used to be controversial, but recently obtained evidence points to a solid causal link. The results of a very recent experiment on cell cultures suggests that these side effects are due to PPIs interfering with endothelial function.
As mentioned in Lucky's answer, PPIs work better than H2As, so the decision which medicine to use must be based on a solid risk assessment by your doctor. The current evidence suggests that at least the PPIs should no longer be prescribed, except to prevent life threatening problems such as intestinal bleeding.