There is a discussion to add masonry layout into css. For now you can use css grid and manually define grid row on each item. Alternative is using some js script though it may negatively affect lighthouse score and jump on page load.
This is for portfolio galleries, comes up a lot for us on photography and content creation sites, so I'm using Masonry.js for now. Very difficu;t to use with content block