Eleven days and a half gone and I have crossed three thousand miles of the perilous deep. Instead of a democratic government, I am under a monarchical government. Instead of the bright, blue sky of America, I am covered with the soft, grey fog of the Emerald Isle [Ireland]. I breathe, and lo! the chattel [slave] becomes a man. I gaze around in vain for one who will question my equal humanity, claim me as his slave, or offer me an insult. I employ a cab—I am seated beside white people—I reach the hotel—I enter the same door—I am shown into the same parlour—I dine at the same table—and no one is offended ... I find myself regarded and treated at every turn with the kindness and deference paid to white people. When I go to church, I am met by no upturned nose and scornful lip to tell me, 'We don't allow niggers in here!'
That's a letter from Douglas.
But the UK did once allow slavery. How did it so quickly shift to this egalitarian position?
We need to interpret this passage as a piece of political rhetoric. Frederick Douglass was campaigning against American slavery and segregation, and was using Britain as an example to try to highlight the gross injustices of the US. In a US context, using Britain as an example of equality was particularly powerful, since American identity was founded on a revolutionary struggle against British tyranny. So while what Douglass says here is basically true - there was not formal segregation in the UK at the time - it's exaggerated for rhetorical purposes. We definitely can't conclude that the UK was egalitarian in the 1840s. Slavery had recently been abolished in Britain's Caribbean and American colonies (in 1836, although freed slaves were obliged to continue working for their former owners as indentured laborers for another 4-5 years afterwards). It had not yet been abolished throughout the empire - full abolition in India was not introduced until 1860.
The way that slavery worked in Britain was also different. It had never been common to own African slaves within the UK itself. British slavery was no less racist than American, but since the plantation slavery was restricted to the Caribbean and American colonies, it didn't impact mainstream British society in the same way - it didn't lead to the expectation of racial segregation in Britain. But there were still significant sections of British society, especially among the elite, who supported segregation in countries with a large black population. Britain was neutral during the US Civil War, but the British elite broadly supported the Confederacy (the main reason for this was that they resented the northern blockade, rather than that they wanted to support slavery, but the fact that the war was being fought to preserve slavery didn't bother them). When the South African governments introduced apartheid policies, they did so with the support of British elites. In fact Jan Smuts, one of the key architects of apartheid, was very popular in the UK including in liberal circles. British governments remained broadly supportive of apartheid South Africa until well into the 1980s.
The open attitudes described by Douglass also need to be seen in light of the fact that, while there had always been non-white people in Britain, their numbers during the 19th century were relatively small. The more prominent minorities in 19th-century Britain were Irish, Jewish, and towards the end of the century, southern European people, and there was a lot of racism directed against them including formal discrimination. It was only in 1828 that the ban on Catholics holding public office was abolished, but in practice their exclusion lasted much longer. In fact, even Tony Blair didn't feel able to formally convert to Catholicism until after he had left office, and the ban on heirs to the throne marrying Catholics was only repealed in 2013. When Britain acquired a substantial, permanent non-white population after World War 2, due to mass migration from the West Indies, South Asia and East Africa, they became targets of an enormous amount of racism. While Britain didn't have formal segregation, there was plenty of informal discrimination, especially in housing. One of the big landlords of postwar London, Peter Rachman, who's so notorious that "Rachmanism" is the common British term for landlords intimidating tenants, was able to build his slum empire because he was one of the few landlords willing to rent to black tenants. The Race Relations Act of 1965 prohibited segregation only in public places, specifically excluding housing. It was only in 1968 that another Race Relations Act banned discrimination in housing and employment. A good insight into black struggles in 1960s and 70s London is the recent TV series Small Axe. The problems have improved somewhat but persist until today. The most notorious incident of official discrimination is the investigation of the murder of Stephen Lawrence by a racist gang in 1993. Essentially the Metropolitan police completely bungled the investigation because they were themselves riddled with racists and were protecting the killers, and the charges against them were all dropped. A subsequent official inquiry found that the Metropolitan police was "institutionally racist."