The ICAO ID (also called ICAO 24-bit address or 'HEX Code') is a unique identification number, which is different for each aircraft, like the chassis number of a car. It is used in the transponder, but also in the ELT, i.e. whenever an aircraft needs to be uniquely identified.
The Flight ID is a bit like a "call sign". It defines how an aircraft is addressed on the radio, e.g. with 'LH 616' for a Lufthansa flight or with 'D-KWAA' for a motor glider, or 'Air Force One' if a US President is en route.
Both are mandatory in every transponder, but with the difference that the Flight ID can contain any text and can also be changed by the pilot. For small aircraft like ours, the Flight ID must correspond to the license plate number according to the currently valid NFL (as of August 2019).
The ICAO identifier is required in the transponder for many purposes, e.g. when signals from several radar stations and multilateration receivers are to be combined, e.g. to provide the controller with a uniform air situation picture (only one symbol on his screen and not several symbols for the same aircraft).
Furthermore, the ICAO identifier is required e.g. for selective TCAS interrogations: TCAS systems can then only request a specific transponder to emit a transponder response, this improves their detection quality and reduces the quantity of responses considerably (otherwise all transponders within range would have to respond, which are usually many). This also reduces the utilization of the transponder frequency, which is important in some areas.