Gastric ulcers occur in the lining of the stomach, while duodenal ulcers are found in the upper part of the small intestine, known as the duodenum. Both types of ulcers are characterized by sores or lesions that develop due to the erosion of the mucosal lining.