You get a feel of good comps by immersing yourself in the community. Read recently published books in your age category and genre (ex: YA fantasy published in last 5 years). They should be published by Big 5 publishers or strong independents.
Check out the review counts on Amazon and Goodreads to get a feel for the popularity. Check out the sales rankings. You can comp titles that are #1 bestsellers, but if they have viewable adaptations (TV/film) or massive fandoms, they're outliers. Once an author has at least one viewable adaptation, all their books are outliers. Try to avoid outliers, but if you must use one, balance it out with a non-outlier.
Agents have different perspectives on comps. Some want them to be published within the past 5 years, some want within the past 3 years. Some only want book comps, others don't mind movie or video game comps. And some would rather have no comps than decent comps.
It really depends on who you're querying.