A decentralized exchange is a trading venue implemented entirely in smart contracts. Users hold their own assets in their own wallets and trade by submitting transactions; the exchange never custodies funds.
DEXes split into two main architectures: AMM (Uniswap, Curve, Balancer, PancakeSwap) and on-chain order book (dYdX v3, Serum, modern derivatives DEXes). Both are non-custodial; both are vulnerable to MEV; both face composability-driven risk from the protocols they integrate with.
For users, DEXes eliminate counterparty risk on the venue itself, but introduce smart-contract risk, oracle risk, and MEV exposure. For builders, DEXes are the most heavily targeted category of DeFi protocol, and the most heavily audited as a result.