The origin of Parliament was from the curia regis, the King's Court. In that early form, the King's Court exercised both judicial and legislative functions. In 1215, with the Magna Carta and the beginning of Parliaments, the House of Lords assumed the judicial functions of the King's Court.
Prior to 1876, it was possible for any member of the House of Lords to hear appeals. Eventually, however, the judicial function tended to be exercised by those appointed specifically to judicial office in the House of Lords, although this was not a formal restriction until 1876.
Since 1876 and until 2009, the judicial function of the House of Lords was formally restricted to be exercised by the Law Lords (see s. 5 of the Appellate Jurisdiction Act 1876). However, the outcome of the appeal was also still formally an action of the entire House of Lords, on the recommendation of the panel of Law Lords that heard the appeal (see Stanley Clark, "Gentlemen, Their Lordships", p. 1443-44). And custom was that only the Law Lords that heard the appeal would vote, with all other members of the House of Lords abstaining.1 Rather than lords via hereditary peerage, the Law Lords were Lords/Ladies holding special qualifications and having received specific appointment to be a "Lord of Appeal in Ordinary." Among other qualifications, they would have already served in a high court or practised as a barrister for fifteen years.
As an example of the kind of background a person might have before appointment as a Law Lord, this is Lord Denning's Wikipedia introduction:
He was called to the bar of England and Wales in 1923 and became a King's Counsel in 1938. Denning became a judge in 1944 when he was appointed to the Probate, Divorce and Admiralty Division of the High Court of Justice, and transferred to the King's Bench Division in 1945. He was made a Lord Justice of Appeal in 1948 after less than five years in the High Court. He became a Lord of Appeal in Ordinary in 1957 and after five years in the House of Lords returned to the Court of Appeal as Master of the Rolls in 1962, a position he held for twenty years.
In 2009, the judicial function of the House of Lords was transfered to the UK Supreme Court. The Law Lords at the time became the first justices of the UK Supreme Court.
1. Citation practice is to indicate that a judgment is from the House of Lords by using parentheses after identifying the reporter. E.g.: "Livingstone v. Rawyards Coal Co. (1880), 5 App. Cas. 25 (H.L.)." Starting in 2001, the House of Lords used vendor-neutral citations managed by the British and Irish Legal Information Institute. The vendor-neutral citations for judgments from the House of Lords use "UKHL" as the abbreviation. BAILII has also provided many older judgments from the House of Lords with unofficial neutral citations following the same convention.