To augment Slayner's answer, I've made a quick example in Minecraft. The way hoppers work is that they prioritize a hopper below drawing the item down over moving the item along in the direction the hopper is facing. So, in this picture, the items traveling along the hopper chain will be sucked into the one below. Note the middle hopper is not pointing down - this is important, as the items must be pulled by the bottom hopper rather than pushed by the top hopper. The bottom hopper thus controls the flow of items, being controlled by the redstone torch below it.
To filter items, you must have all the slots in the hopper below the chain filled with the item you want to filter. The redstone makes it so that the hopper will hold 22 items, and when a 23rd item goes in, it will release one to the lowest hopper and into the chest.
If you need to sort items that stack to 16, you will need to change the amount in the hopper, because comparitors work on fractions of stacks rather than pure number of items (this also means you cannot sort unstackable items this way). Just put one of the 16-per-stack items in each hopper slot, like so:
Note that only the leftmost slot need contain the actual item being filtered. Therefore, the others can be filled with a block/item that you know will never enter the system. Also, this means that you may use items that stack to 16 in the other four slots, to reduce the number of items needed in the hopper. Renamed items, or non-sorted items such as eggs or snowballs work well. For sorting items that stack to 64, you need 4 items plus 6 of the item you are sorting (will try to remember to add a picture when I get home from work).
This design is tileable, meaning it can be stacked horizontally with no space in between (alternating between trapped and regular chests if below 1.13). There are other designs, and more complicated ways of sorting items, but this is the most common.
The Minecraft wiki has a helpful table for the "hardness" of blocks and also their correct tool: https://minecraft.gamepedia.com/Breaking#Blocks_by_hardness (archive)
Since every block only has at most one correct tool (with the exception of swords breaking cobwebs and leaves a bit faster, for which the correct tool is shears), you can see what breaks with normal (hand) speed when using a pickaxe: All that don't have a pickaxe icon next to them. That also often gives you the added mining time for blocks where you don't get the drop due to using the wrong tool.
Haste doesn't matter for this question, because it affects all blocks and tools equally.
So, what is the hardest block that isn't broken faster with a pickaxe? Cobwebs. It takes 20 seconds to mine one by hand. The problem is that it's hard to get. If you need a lot of it, you'll have to explore a lot.
The farmable blocks with the highest hardness are wooden trapdoors and doors (4.5s), then chests, trapped chests and crafting tables (3.75s). They are mined much faster with the wrong tool, because you get the drop.
But there's no other block that breaks slower due to not getting the drop until you get to snow blocks (1s).
If you also have to hold down the "use" button for your AFK machine, then fences, logs, planks, wooden slabs and stairs (3s) might be your best options.
Alternatively, if that's possible in your case, you could design your farm/machine in a way that only water, lava, air or unbreakable blocks are in the direction you'll be mining, for example you could put it on top of the bedrock or hollow out the space behind it and add a water stream to get the drops.
Another option would be to constantly move blocks back and forth in the direction you mine. As long as the time to mine the moved block is longer than the time it stays in one place, you will never break it. Your best options here are the wooden blocks named above, since coal blocks (hardest movable blocks) are mined faster with a diamond pickaxe, even without enchantments.
Entities in the way also work, if you don't need something to place a block against. You can punch something and proceed to mine while still holding down the button, but if you start mining a block, you'll never hit a mob with that same button press. Your best options there are likely snow golems or paintings.
Best Answer
You cannot transfer an enchantment from a tool onto a book in vanilla survival without cheats.
You can however combine two books (or any two items of the same type) and merge the enchantments with an anvil.
See here for more information on enchantments