Is there a quick way to transfer materials from one object to another?

I know I can link materials but this way it inks only a list of materials . How I can project/ transfer material per face ID if I don’t want the mesh geo perfectly instanced, having slightly different topology ? Is there a way to do so? With “data transfer” modifier or something?