There are two main ways to create a block. The first is through the admin interface at Structure then Block layout. Click Custom block library, then Add custom block, choose a block type, fill in the content, and save.
Once created, you can place the block in any region through the Block layout page. This approach needs no code and is ideal for editors.
The second way is to write a custom module that defines a plugin derived from BlockBase. This gives you full control over the block’s rendering, configuration form, and access logic. Use this approach when you need dynamic behaviour that goes beyond static HTML. For most sites, custom block types with fields handle the majority of needs without requiring any custom code.