Proper kettle of fish this one! but I couldn’t resist throwing my 2 cents in.
Racism is an inherent belief that one group are superior to another based purely on membership to said group; that for example being white would mean that you are superior to non-whites by virtue of your whiteness. Although this is of course the most common example, it’s important to remember that racism has been perpetrated by, and against, a multitude of groups such as the current situation in China with Uighur Muslims and so on.
Nationalism is the identification with ones nation and the desire to see that nation succeed. often, but not exclusively, to the detriment of other nations.
One can be a nationalist but not a racist, but I would argue that it’s quite rare to meet a racist who is not also a nationalist.
I don’t think nationalism is always a bad thing - we saw for example at the onset of COVID-19 in Europe a large degree of nationalism as all of these countries that are part of the Schengen Agreement suddenly conveniently ignored the treaty in order to shut their borders and protect their citizens (uselessly, as it turned out) against the spread of C19.
However, nationalist sentiment needs to be controlled carefully because the downside to it could be seen, you could argue, In the Capitol siege/riots on January 6th as nationalist fervour tends to spread and morph very rapidly and almost always ends in violence and almost always ends in Fascism
Sorry for the wall of text but this is such a fascinating topic!