Background/Aims Upper gastrointestinal cancers (oesophageal/stomach) have high mortality rates and are often diagnosed after the disease has progressed, making it important to identify populations at greater risk of upper gastrointestinal (UGI) cancer to promote earlier diagnosis. This study aims to determine if there is an association between a broad range of long-term conditions (LTCs) and incidence of UGI cancers. Method A prospective-based cohort of 487,798 UK Biobank participants (age 37–73 years) after excluding previous UGI cancer. Least Absolute Shrinkage and Selection Operator (LASSO) regression used to identify candidate LTCs as predictors for UGI cancer. Strength of association was studied using Cox’s regression adjusting for demographics and lifestyle factors. Results After median follow-up period of 86 months, 598 participants developed oesophageal cancer; 397 developed stomach cancer. In fully adjusted models, participants with alcohol addiction (Hazard Ratio-HR 4.11, 95% Confidence Interval-CI 2.01–8.43), Barrett’s oesophagus (HR 5.68, 95% CI 3.36–9.58), bronchiectasis (HR 2.72, 95% CI 1.01–7.31), diabetes (HR 1.38, 95% CI 1.06–1.81), hiatus hernia (HR 1.69, 95% CI 1.16–2.45), Parkinson’s disease (HR 3.86, 95% CI 1.60–9.37) and psoriasis/eczema (HR 1.53, 95% 1.08–2.17) were observed to have a higher risk of oesophageal cancer. Stomach cancer incidence was higher among participants with anorexia/bulimia (HR 8.86, 95% CI 1.20–65.14), Barrett’s oesophagus (HR 3.37, 95% 1.39–8.14), chronic fatigue syndrome (HR 3.36, 95% CI 1.25–9.03), glaucoma (HR 2.06, 95% CI 1.16–3.67), multiple sclerosis (HR 4.60, 95% CI 1.71–12.34), oesophageal stricture (HR 1.04, 95% CI 1.46–74.46) and pernicious anaemia (HR 6.93, 95% CI 3.42–14.03). Conclusion Previously unrecognised LTCs may have a role in symptom appraisal and risk assessment of UGI cancer in primary care. Further research should explore mechanisms underpinning these findings and determine whether they are replicable in other populations.