Both these mean long, how to differentiate?
You can use them interchangeably.
They're synonyms, but like most synonyms, people prefer one over the other for certain expressions. You won't hear a native speaker referring to a tall people as "longo", only "alto" or "comprido".
As a tip, native speakers use "long" usually referring a distance in a path, while "comprido" is used to express a measure (Example: The height of a person, or the length of a pant)
Most of time for heights it is used alto.