I am used to creating a .Net Framework console application and exposing a Add(int x, int y) function via a WCF service from scratch with Class Library (.Net Fra
WCF does many things; it is an easy way to remote procedure calls between two applications (processes) on one machine, using named pipes; it can be a high volume internal client-server communication channel between .NET components, using binary serialization over TCPIP; or it can provide a standardised cross-technology API, e.g. via SOAP. It even has support for things like asynchronous messaging, via MSMQ.
For .NET Core, there are different replacements based on the purpose.
For cross-platform API, you would replace this with a REST service using ASP.NET.
For inter-process connections, or client-server connection, gRPC would be good, with an excellent answer given by @Gopi.
So the answer to "What replaces WCF" depends on what you are using it for.