Custards are one of the main element of most cakes and many desserts. They can be made with many different ingredients, like fruit, caramel, vanilla essence, chocolate or even cheese. And they can really make the differents and bring your simple cake to a new level. They are often a final ingredient. For example, between the layers of a sponge cake, or on the top of a cupcake. But they can also be a dessert by themselves, like crème brûlée, or chocolate mousse.
Some recipes, like chocolate pastry cream, can be used both as a stuffing and as a creamy dessert, maybe accompanied by wafer or something similar.