Butter is generally preferred for shortcrust pastry due to its flavor and the ability to create a flakier texture. Margarine can be used as a substitute, especially for those looking for a dairy-free option, but it may result in a slightly different texture and taste. Butter’s fat content helps form better layers in the pastry, making it crisper and richer.