We consider a metal with interaction mediated by fluctuations of an order parameter, which condenses at a quantum critical point (QCP). This interaction gives rise to fermionic incoherence in the normal state and also mediates pairing. Away from a QCP, the pairing restores fermionic coherence almost immediately below Tc. We show that near a QCP, fermions regain coherence only below a certain Tcross, which is smaller than the onset temperature for the pairing Tp. At T<Tcross the system behavior is conventional in the sense that both the density of states (DOS) and the spectral function (SF) have sharp gaps, which close in as T increases. At higher Tcross<T<Tp, the DOS has a dip, which fills in with increasing T, while the SF shows either the same behavior as the DOS, or has a peak at ω=0, depending on the position on the Fermi surface, leading to a Fermi arc. We argue that phase fluctuations are strong at T>Tcross, and the actual Tc≥Tcross, while at larger Tc<T<Tp the system displays a pseudogap behavior. We argue that our theory explains the crossover from gap closing to gap filling, observed in cuprate superconductors at T≤Tc, and the persistence of the dip in the DOS and and the Fermi arc above Tc.