The relationship between heavy metal contamination in sediment and macrofauna in the upper Gulf of Thailand is presented as an indication of the environmental quality of coastal waters. This study aims to monitor five heavy metal elements (As, Cd, Mn, Ni, and Pb) between sediment and the sandworm (Perinereis quatrefagesi (P. quatrefagesi)). The geoaccumulation index (Igeo), enrichment factor (EF), and contamination factor (CF), including the pollution load index (PLI), were used for statistical analyses by one-way analysis of variance (ANOVA), and differences in the data were compared using the least significant difference (LSD) test. The sediment heavy metal concentrations were found to decrease (Al > Mn > Pb > Ni > Cd > As), and the quantity of heavy metal contamination in the sediment was not over the emergency point defined by the Pollution Control Department in Thailand. The Mn at the SH and SP points has Igeo > 0 but <1 and is considered not polluted to moderately polluted. The EF overall is <2 and is deficient in mineral enrichment. The CF of the Samut Sakhon (SH) and Samut Prakan (SP) sites had high Al and Mn values, indicating a low pollution level, but the PLI had an all-site average of 0.0215 ± 0.0252, which is <1. This indicates that the present areas are close to ideal and not polluted. To measure heavy metals in macrofauna, P. quatrefagesi was assessed, and concentrations were found to decrease (Mn > Ni > Cd > Pb > As). The Mn between sediment and the sandworm was directly correlated (r = 0.976;
p
<
0.01
). The sandworm performs as a bioindicator for the quality of coastal sediment, specifically with Mn; thus, the result present at a baseline level may grow in the future if there is no control measure for defensive measures.