In the book, the narrator Allen Quatermain has conflicting views on the Zulu, Khoisan, and other indigenous people around him. He is very familiar with their culture, being fluent in their language, yet also on occasion insults their primitivity. He is uncomfortable with and distasteful towards saying n*****, yet also refers to people as Kafirs and Hottentots, both of which are currently considered racial slurs. I’m not asking about the narrator’s views however, but the historical connotations of these words. Did Victorian British consider Kafir and Hottentot as disparaging as the n-word, or was it a “culturally aware” title for the time?
The terms were used ethnologically in Haggard's time, and did not carry pejorative meanings beyond the significant Victorian racial biases.
"Hottentot" was first used by the Dutch in the Cape Colony, and its etymology is debated. It eventually came to describe the Khoikhoi, a non-Bantu people in the south of Africa. The "Hottentot" people were described in contemporary "racial science" as being particularly un-European. Colonialists described physical features, "savage" behavior, and linguistic differences (use of the click consonant) that they considered to be proof of the differences between them and Europeans. For a time some writers, such as Edward Long in 1774, argued that the offspring of the two would eventually become inferitle, illustrating that they are not the same species. These descriptions and attitudes existed even before the forced display of Sarah Baartman 1810-1815 as the "Hottentot Venus," but her case is a telling example of them. The popular and scientific attention on her focused on her supposedly "ape-like" qualities, and the story of her exploitation and tragic death, illustrates the dehumanization of her race. It is because of such depictions that the term acquired its negative connotation. Haggard uses the term 11 times in the novel, and clearly intends to use it as an ethnonym. 9 of those usages is for a particular character, Ventvögel, for whom "Hottentot" is given as his ethnic group, and the other 2 refer to another character in a similar fashion. The narrator, Allan Quatermain, subscribes to deterministic/essentialist views of race and considers race to be a determining factor in behavior, such as when he claims that Ventvögel, "like most Hottentots," ignores the rain or cannot stand cold.
The other term, which I am not comfortable typing and is often now known as "the K word," comes from Arabic, where it was a term for unbelievers that was applied to all black Africans by Arabic-speaking traders. It was used by the English in Haggard's day to refer either to all black Africans or to the Bantu peoples specifically. It would take on a very strong pejorative meaning in South Africa particularly during apartheid, to the point that in 1976 it became a criminal act to use the term. The novel uses it frequently, sometimes for black characters whose specific ethnic identity is not stated and sometimes for those for whom it is, such as Zulus.
As suggested above, the terms are used by Haggard to follow late Victorian racial theory in categorizing Africans into separate and exclusive races. Many Victorian scientists argued for polygenesis, or the idea that different human races "arose" from apes at different times (vs monogenesis). This came with the idea that some "ascended" more recently, and thus are inferior and closer to apes. One key example of this is Charles Pickering in his 1848 Races of Man and their Geographical Distribution. This provided both a convenient way of "categorizing" races and a scientific justification for colonialism and white supremacy.
I will close with a passage from the novel that further illustrates Haggard's racial beliefs, which were common in this era: that the closer a black character is to Europeans in physical appearance and behavior, the more highly evolved that character is, and thus more moral and more intelligent. In this passage, Quatermain describes the black characters in the "lost world" he and his companions enter:
These women, for a native race, are exceedingly handsome. They are tall and graceful, and their figures are wonderfully fine. The hair, though short, is rather curly than woolly, the features are frequently aquiline, and the lips are not unpleasantly thick, as is the case among most African races. But what struck us most was their exceedingly quiet and dignified air. They were as well-bred in their way as the habituées of a fashionable drawing-room, and in this respect they differ from Zulu women and their cousins the Masai who inhabit the district beyond Zanzibar.
I can suggest many sources about Victorian racial attitudes, but I think you would be particularly interested in this one, about how races were identified and described in the period.