Preamps are applied to match signal levels – and to refine/shape the sound qualities of an instrument or microphone feed. Considered a preliminary stage, prior to final amplification (in live or recording situations). Designed to feed into a mixer, a preamp can replace the need for a traditional amplifier. Preamps can be specialized for guitars, microphones (vocals) – or bass guitars, etc. Some preamps even contain tubes for warmer sounds.
DI Boxes (Direct Boxes) are typically applied to split an instrument signal into its normal amplification (ex. guitar amplifier) — and also provide an XLR feed into a mixer. Traditional XLR impedance matching DI boxes were passive (not powered) – but many DI boxes today are powered for microphone applications (or to boost signal).
Many devices are hybrids (containing cross-features)- where the preamp device can both (a) convert and match impedance for multiple amplification output formats – like a DI Box – and (b) shape, refine your sound – like a Preamp.