For your first question : It depends which code you want to override.
For example you want to change the theme,the layout and front end display (not any functional change) you can do it.app/design/frontend/Myvendor/mytheme/<Vendorname_vendormodule>/
If you want to update/rewrite the logic you have to do it in app/code/{Vendor}/{Module}
.
For your second question : To override block you need to add code in app/code/{Vendor}/{Module} directory by following steps
For example you have to override Magento\Catalog\Block\Product\ListProduct block
1.) create file app/code/{Vendor}/{Module}/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Catalog\Block\Product\ListProduct" type="{Vendor}\{Module}\Block\Rewrite\Product\ListProduct" />
</config>
2.) create file app/code/{Vendor}/{Module}/Block/Rewrite/Product/ListProduct.php
<?php
/**
* Hello Rewrite Product ListProduct Block
*/
namespace {Vendor}\{Module}\Block\Rewrite\Product;
class ListProduct extends \Magento\Catalog\Block\Product\ListProduct
{
public function _getProductCollection()
{
// Do your stuff here
}
}
Ref: Overriding Block, Model, Controller in Magento2