No, it won't. Even though both types have 288 pins, DDR4 and DDR5 memory is electrically incompatible. The two types have a different notch position, to prevent anyone from inserting a DDR5 module into a DDR4 motherboard, or vice versa.
That means you'll need a newer motherboard and compatible CPU to run faster, newer DDR5 memory. Essentially you have to build a new PC for the new memory specification.