How can I get the width or height of an image field image into a twig template?
You can't access the array values because it is protected. But you don't need to, because you can get the properties from a field item directly:

{% set image_width = content.field_image.0['#item'].width %}


BTW the content variable is a render array with no fixed structure. The presence and position of #item changes dependent on the field formatter and other core, contrib or custom code.

So it's better to use the entity object, for example the paragraph entity in a paragraph template:

{% set image_width = paragraph.field_image.0.width %}