“Speaking solely as a citizen,” he wrote, “I would be delighted to awake one morning and learn that Congress had just passed legislation adding sexual orientation to the list of grounds of employment discrimination prohibited under Title VII of the Civil Rights Act of 1964. I am confident that one day — and I hope that day comes soon — I will have that pleasure.”

“I would be equally pleased to awake to learn that Congress had secretly passed such legislation more than a half-century ago — until I actually woke up and realized that I must have been still asleep and dreaming,” Judge Lynch wrote. “Because we all know that Congress did no such thing.”

The arguments in the Second Circuit had a curious feature: Lawyers for the federal government appeared on both sides. One lawyer, representing the E.E.O.C., said Title VII barred discrimination against gay people. Another, representing the Trump administration, took the contrary view.

The Georgia case was brought by a child welfare services coordinator who said he was fired for being gay. The 11th Circuit, in Atlanta, ruled against him in a short, unsigned opinion that cited a 1979 decision that had ruled that “discharge for homosexuality is not prohibited by Title VII.”

The justices also agreed to decide the separate question of whether Title VII bars discrimination against transgender people. The case, R.G. & G.R. Harris Funeral Homes v. Equal Employment Opportunity Commission, No. 18-107, concerns Aimee Stephens, who was fired from a Michigan funeral home after she announced in 2013 that she was a transgender woman and would start working in women’s clothing.

“What I must tell you is very difficult for me and is taking all the courage I can muster,” she wrote to her colleagues. “I have felt imprisoned in a body that does not match my mind, and this has caused me great despair and loneliness.”

Ms. Stephens had worked at the funeral home for six years. Her colleagues testified that she was able and compassionate.