One is a literary device, and the other is a behavior modification technique.
----------------------------------------------------------------
As for definitions, so glad you asked!
Ethnic Cleansing
Rendering an area ethnically homogeneous by using force or intimidation to remove persons of given groups from the area; a purposeful policy designed by one ethnic or religious group to remove by violent and terror-inspiring means the civilian population of another ethnic or religious group from certain geographic areas.
https://www.un.org/en/genocideprevention/ethnic-cleansing.shtml
Ethnic Cleansing: see also modern day Yemen; see also post WW II era Eastern Europe ; see also circa 1980 Soviet Union
------------------------------------------------------------
Genocide
Acts committed with intent to destroy, in whole or in part, a national, ethnical, racial or religious group, as such. To constitute genocide, there must be a proven intent on the part of perpetrators to physically destroy a national, ethnical, racial or religious group.
https://www.un.org/en/genocideprevention/genocide.shtml#:~:text=To%20constitute%20genocide%2C%20there%20must,to%20simply%20disperse%20a%20group.
Genocide: see also Hamas from its inception to the present; see also The Young Turks circa 1915; see also circa 1938-1945 Nazi Germany
---------------------------------------------------------
Apartheid
The implementation and maintenance of a system of legalized racial segregation in which one racial group is deprived of political and civil rights. Apartheid policies include, but are not limited to: the prohibition of mixed marriages, banning a specific racial or ethnic group from access to certain meetings and unions, and the restriction of movement, prohibiting access to certain public spaces.
https://www.law.cornell.edu/wex/apartheid
Apartheid: see also pre-1990 South Africa; see also modern day Iran; see also circa 1933-1938 Nazi Germany
-------------------------------------------------------
Hope that helps!