A photonics-based digital and analog self-interference cancellation approach for in-band full-duplex communication systems and frequency-modulated continuous-wave radar systems is reported. One dual-drive Mach-Zehnder modulator is used to implement the analog self-interference cancellation by pre-adjusting the delay and amplitude of the reference signal applied to the dual-drive Mach-Zehnder modulator in the digital domain. The amplitude is determined via the received signal power, while the delay is searched by the cross-correlation and bisection methods. Furthermore, recursive least squared or normalized least mean square algorithms are used to suppress the residual self-interference in the digital domain. Quadrature phase-shift keying modulated signals and linearly frequency-modulated signals are used to experimentally verify the proposed method. The analog cancellation depth is around 20 dB, and the total cancellation depth is more than 36 dB for the 2-Gbaud quadrature phase-shift keying modulated signals. For the linearly frequency-modulated signals, the analog and total cancellation depths are around 19 dB and 34 dB, respectively.