Both "species" have distinctive anatomical features in their teeth and skulls which are a bit harder to explain unless you're a physical anthropologist. Even the anthropologists argue over some of the fossils and usually they rely on the context of the fossils to make a judgement - Neanderthals are from Europe and the Near East, after ~300 kya, while Erectus is from Asia and Africa, before ~500 kya.
You might have read of Erectus persisting into more recent eras in Indonesia. This is based on a dating of particular fossils to ~50 kya. This dating was later redone by the same team, producing a much earlier ~500 kya. There certainly seem to be archaic features appearing in some very recent bones, in Africa and China, but Erectus proper is gone by about ~500-300 kya, replaced by "archaic Homo sapiens" and then modern Homo sapiens.