A common strategy to identify orthologs is called the reciprocal best hit (RCBH):
If the two sequences are their best mutual match across the whole
genome of the two lineage, then they are probably direct orthologs (XA' and YA' on the image below for instance).
If other sequences in the two lineages are better matches, then the two
sequences could be actually the orthologs of their respective paralog instead (XA' with YA'', what is called below an out-paralog).